mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-18 21:02:41 +01:00
Implement a "Space is any of..." condition in Herald
Summary: Ref T8498. Allow Herald rules to act on the Space which contains an object. Test Plan: - Wrote a "Space is any of..." rule, created tasks that matched and failed the rule. - Also created a Pholio rule with the "Space..." condition. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T8498 Differential Revision: https://secure.phabricator.com/D13242
This commit is contained in:
parent
88e7cd158f
commit
d5668ddeae
6 changed files with 34 additions and 11 deletions
|
@ -371,7 +371,7 @@ return array(
|
||||||
'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => 'e5822781',
|
'rsrc/js/application/doorkeeper/behavior-doorkeeper-tag.js' => 'e5822781',
|
||||||
'rsrc/js/application/files/behavior-icon-composer.js' => '8ef9ab58',
|
'rsrc/js/application/files/behavior-icon-composer.js' => '8ef9ab58',
|
||||||
'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888',
|
'rsrc/js/application/files/behavior-launch-icon-composer.js' => '48086888',
|
||||||
'rsrc/js/application/herald/HeraldRuleEditor.js' => '271ffdd7',
|
'rsrc/js/application/herald/HeraldRuleEditor.js' => 'b2cae298',
|
||||||
'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec',
|
'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec',
|
||||||
'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3',
|
'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3',
|
||||||
'rsrc/js/application/maniphest/behavior-batch-editor.js' => 'f5d1233b',
|
'rsrc/js/application/maniphest/behavior-batch-editor.js' => 'f5d1233b',
|
||||||
|
@ -527,7 +527,7 @@ return array(
|
||||||
'global-drag-and-drop-css' => '697324ad',
|
'global-drag-and-drop-css' => '697324ad',
|
||||||
'harbormaster-css' => '49d64eb4',
|
'harbormaster-css' => '49d64eb4',
|
||||||
'herald-css' => '826075fa',
|
'herald-css' => '826075fa',
|
||||||
'herald-rule-editor' => '271ffdd7',
|
'herald-rule-editor' => 'b2cae298',
|
||||||
'herald-test-css' => '778b008e',
|
'herald-test-css' => '778b008e',
|
||||||
'homepage-panel-css' => 'e34bf140',
|
'homepage-panel-css' => 'e34bf140',
|
||||||
'inline-comment-summary-css' => '51efda3a',
|
'inline-comment-summary-css' => '51efda3a',
|
||||||
|
@ -1009,15 +1009,6 @@ return array(
|
||||||
'phabricator-drag-and-drop-file-upload',
|
'phabricator-drag-and-drop-file-upload',
|
||||||
'phabricator-draggable-list',
|
'phabricator-draggable-list',
|
||||||
),
|
),
|
||||||
'271ffdd7' => array(
|
|
||||||
'multirow-row-manager',
|
|
||||||
'javelin-install',
|
|
||||||
'javelin-util',
|
|
||||||
'javelin-dom',
|
|
||||||
'javelin-stratcom',
|
|
||||||
'javelin-json',
|
|
||||||
'phabricator-prefab',
|
|
||||||
),
|
|
||||||
'2818f5ce' => array(
|
'2818f5ce' => array(
|
||||||
'javelin-install',
|
'javelin-install',
|
||||||
'javelin-util',
|
'javelin-util',
|
||||||
|
@ -1701,6 +1692,15 @@ return array(
|
||||||
'javelin-uri',
|
'javelin-uri',
|
||||||
'javelin-request',
|
'javelin-request',
|
||||||
),
|
),
|
||||||
|
'b2cae298' => array(
|
||||||
|
'multirow-row-manager',
|
||||||
|
'javelin-install',
|
||||||
|
'javelin-util',
|
||||||
|
'javelin-dom',
|
||||||
|
'javelin-stratcom',
|
||||||
|
'javelin-json',
|
||||||
|
'phabricator-prefab',
|
||||||
|
),
|
||||||
'b3a4b884' => array(
|
'b3a4b884' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'phabricator-prefab',
|
'phabricator-prefab',
|
||||||
|
|
|
@ -44,6 +44,7 @@ abstract class HeraldAdapter {
|
||||||
const FIELD_TASK_STATUS = 'taskstatus';
|
const FIELD_TASK_STATUS = 'taskstatus';
|
||||||
const FIELD_PUSHER_IS_COMMITTER = 'pusher-is-committer';
|
const FIELD_PUSHER_IS_COMMITTER = 'pusher-is-committer';
|
||||||
const FIELD_PATH = 'path';
|
const FIELD_PATH = 'path';
|
||||||
|
const FIELD_SPACE = 'space';
|
||||||
|
|
||||||
const CONDITION_CONTAINS = 'contains';
|
const CONDITION_CONTAINS = 'contains';
|
||||||
const CONDITION_NOT_CONTAINS = '!contains';
|
const CONDITION_NOT_CONTAINS = '!contains';
|
||||||
|
@ -101,6 +102,7 @@ abstract class HeraldAdapter {
|
||||||
const VALUE_TASK_STATUS = 'taskstatus';
|
const VALUE_TASK_STATUS = 'taskstatus';
|
||||||
const VALUE_LEGAL_DOCUMENTS = 'legaldocuments';
|
const VALUE_LEGAL_DOCUMENTS = 'legaldocuments';
|
||||||
const VALUE_APPLICATION_EMAIL = 'applicationemail';
|
const VALUE_APPLICATION_EMAIL = 'applicationemail';
|
||||||
|
const VALUE_SPACE = 'space';
|
||||||
|
|
||||||
private $contentSource;
|
private $contentSource;
|
||||||
private $isNewObject;
|
private $isNewObject;
|
||||||
|
@ -219,6 +221,19 @@ abstract class HeraldAdapter {
|
||||||
$value[] = $this->getApplicationEmail()->getPHID();
|
$value[] = $this->getApplicationEmail()->getPHID();
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
|
case self::FIELD_SPACE:
|
||||||
|
$object = $this->getObject();
|
||||||
|
|
||||||
|
if (!($object instanceof PhabricatorSpacesInterface)) {
|
||||||
|
throw new Exception(
|
||||||
|
pht(
|
||||||
|
'Adapter object (of class "%s") does not implement interface '.
|
||||||
|
'"%s", so the Space field value can not be determined.',
|
||||||
|
get_class($object),
|
||||||
|
'PhabricatorSpacesInterface'));
|
||||||
|
}
|
||||||
|
|
||||||
|
return PhabricatorSpacesNamespaceQuery::getObjectSpacePHID($object);
|
||||||
default:
|
default:
|
||||||
if ($this->isHeraldCustomKey($field_name)) {
|
if ($this->isHeraldCustomKey($field_name)) {
|
||||||
return $this->getCustomFieldValue($field_name);
|
return $this->getCustomFieldValue($field_name);
|
||||||
|
@ -400,6 +415,7 @@ abstract class HeraldAdapter {
|
||||||
self::FIELD_TASK_STATUS => pht('Task status'),
|
self::FIELD_TASK_STATUS => pht('Task status'),
|
||||||
self::FIELD_PUSHER_IS_COMMITTER => pht('Pusher same as committer'),
|
self::FIELD_PUSHER_IS_COMMITTER => pht('Pusher same as committer'),
|
||||||
self::FIELD_PATH => pht('Path'),
|
self::FIELD_PATH => pht('Path'),
|
||||||
|
self::FIELD_SPACE => pht('Space'),
|
||||||
) + $this->getCustomFieldNameMap();
|
) + $this->getCustomFieldNameMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -453,6 +469,7 @@ abstract class HeraldAdapter {
|
||||||
case self::FIELD_PUSHER:
|
case self::FIELD_PUSHER:
|
||||||
case self::FIELD_TASK_PRIORITY:
|
case self::FIELD_TASK_PRIORITY:
|
||||||
case self::FIELD_TASK_STATUS:
|
case self::FIELD_TASK_STATUS:
|
||||||
|
case self::FIELD_SPACE:
|
||||||
return array(
|
return array(
|
||||||
self::CONDITION_IS_ANY,
|
self::CONDITION_IS_ANY,
|
||||||
self::CONDITION_IS_NOT_ANY,
|
self::CONDITION_IS_NOT_ANY,
|
||||||
|
@ -957,6 +974,8 @@ abstract class HeraldAdapter {
|
||||||
return self::VALUE_TASK_PRIORITY;
|
return self::VALUE_TASK_PRIORITY;
|
||||||
case self::FIELD_TASK_STATUS:
|
case self::FIELD_TASK_STATUS:
|
||||||
return self::VALUE_TASK_STATUS;
|
return self::VALUE_TASK_STATUS;
|
||||||
|
case self::FIELD_SPACE:
|
||||||
|
return self::VALUE_SPACE;
|
||||||
default:
|
default:
|
||||||
return self::VALUE_USER;
|
return self::VALUE_USER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,7 @@ final class HeraldManiphestTaskAdapter extends HeraldAdapter {
|
||||||
self::FIELD_TASK_STATUS,
|
self::FIELD_TASK_STATUS,
|
||||||
self::FIELD_IS_NEW_OBJECT,
|
self::FIELD_IS_NEW_OBJECT,
|
||||||
self::FIELD_APPLICATION_EMAIL,
|
self::FIELD_APPLICATION_EMAIL,
|
||||||
|
self::FIELD_SPACE,
|
||||||
),
|
),
|
||||||
parent::getFields());
|
parent::getFields());
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ final class HeraldPholioMockAdapter extends HeraldAdapter {
|
||||||
self::FIELD_CC,
|
self::FIELD_CC,
|
||||||
self::FIELD_PROJECTS,
|
self::FIELD_PROJECTS,
|
||||||
self::FIELD_IS_NEW_OBJECT,
|
self::FIELD_IS_NEW_OBJECT,
|
||||||
|
self::FIELD_SPACE,
|
||||||
),
|
),
|
||||||
parent::getFields());
|
parent::getFields());
|
||||||
}
|
}
|
||||||
|
|
|
@ -632,6 +632,7 @@ final class HeraldRuleController extends HeraldController {
|
||||||
'email' => new PhabricatorMetaMTAMailableDatasource(),
|
'email' => new PhabricatorMetaMTAMailableDatasource(),
|
||||||
'userorproject' => new PhabricatorProjectOrUserDatasource(),
|
'userorproject' => new PhabricatorProjectOrUserDatasource(),
|
||||||
'applicationemail' => new PhabricatorMetaMTAApplicationEmailDatasource(),
|
'applicationemail' => new PhabricatorMetaMTAApplicationEmailDatasource(),
|
||||||
|
'space' => new PhabricatorSpacesNamespaceDatasource(),
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($sources as $key => $source) {
|
foreach ($sources as $key => $source) {
|
||||||
|
|
|
@ -222,6 +222,7 @@ JX.install('HeraldRuleEditor', {
|
||||||
case 'taskstatus':
|
case 'taskstatus':
|
||||||
case 'legaldocuments':
|
case 'legaldocuments':
|
||||||
case 'applicationemail':
|
case 'applicationemail':
|
||||||
|
case 'space':
|
||||||
var tokenizer = this._newTokenizer(type);
|
var tokenizer = this._newTokenizer(type);
|
||||||
input = tokenizer[0];
|
input = tokenizer[0];
|
||||||
get_fn = tokenizer[1];
|
get_fn = tokenizer[1];
|
||||||
|
|
Loading…
Reference in a new issue