Page MenuHomePhabricator

D8156.id18454.diff
No OneTemporary

D8156.id18454.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -370,7 +370,7 @@
'rsrc/js/application/files/behavior-icon-composer.js' => 'ea38f732',
'rsrc/js/application/files/behavior-launch-icon-composer.js' => '6ec125a0',
'rsrc/js/application/harbormaster/behavior-reorder-steps.js' => 'b21125a5',
- 'rsrc/js/application/herald/HeraldRuleEditor.js' => '4366c8cc',
+ 'rsrc/js/application/herald/HeraldRuleEditor.js' => '4f31d692',
'rsrc/js/application/herald/PathTypeahead.js' => 'f7fc67ec',
'rsrc/js/application/herald/herald-rule-editor.js' => '7ebaeed3',
'rsrc/js/application/maniphest/behavior-batch-editor.js' => '391457d7',
@@ -514,7 +514,7 @@
'diviner-shared-css' => 'be90f718',
'global-drag-and-drop-css' => '697324ad',
'herald-css' => '59d48f01',
- 'herald-rule-editor' => '4366c8cc',
+ 'herald-rule-editor' => '4f31d692',
'herald-test-css' => '2b7d0f54',
'inline-comment-summary-css' => '14a91639',
'javelin-aphlict' => '493665ee',
@@ -1054,19 +1054,6 @@
0 => 'javelin-install',
1 => 'javelin-event',
),
- '4366c8cc' =>
- array(
- 0 => 'multirow-row-manager',
- 1 => 'javelin-install',
- 2 => 'javelin-typeahead',
- 3 => 'javelin-util',
- 4 => 'javelin-dom',
- 5 => 'javelin-tokenizer',
- 6 => 'javelin-typeahead-preloaded-source',
- 7 => 'javelin-stratcom',
- 8 => 'javelin-json',
- 9 => 'phabricator-prefab',
- ),
'441f2137' =>
array(
0 => 'javelin-behavior',
@@ -1110,6 +1097,19 @@
1 => 'javelin-dom',
2 => 'javelin-reactor-dom',
),
+ '4f31d692' =>
+ array(
+ 0 => 'multirow-row-manager',
+ 1 => 'javelin-install',
+ 2 => 'javelin-typeahead',
+ 3 => 'javelin-util',
+ 4 => 'javelin-dom',
+ 5 => 'javelin-tokenizer',
+ 6 => 'javelin-typeahead-preloaded-source',
+ 7 => 'javelin-stratcom',
+ 8 => 'javelin-json',
+ 9 => 'phabricator-prefab',
+ ),
'4f344388' =>
array(
0 => 'javelin-install',
diff --git a/src/applications/herald/adapter/HeraldAdapter.php b/src/applications/herald/adapter/HeraldAdapter.php
--- a/src/applications/herald/adapter/HeraldAdapter.php
+++ b/src/applications/herald/adapter/HeraldAdapter.php
@@ -39,6 +39,7 @@
const FIELD_AUTHOR_RAW = 'author-raw';
const FIELD_COMMITTER_RAW = 'committer-raw';
const FIELD_IS_NEW_OBJECT = 'new-object';
+ const FIELD_TASK_PRIORITY = 'taskpriority';
const CONDITION_CONTAINS = 'contains';
const CONDITION_NOT_CONTAINS = '!contains';
@@ -89,6 +90,7 @@
const VALUE_CONTENT_SOURCE = 'contentsource';
const VALUE_USER_OR_PROJECT = 'userorproject';
const VALUE_BUILD_PLAN = 'buildplan';
+ const VALUE_TASK_PRIORITY = 'taskpriority';
private $contentSource;
private $isNewObject;
@@ -233,6 +235,7 @@
self::FIELD_AUTHOR_RAW => pht('Raw author name'),
self::FIELD_COMMITTER_RAW => pht('Raw committer name'),
self::FIELD_IS_NEW_OBJECT => pht('Is newly created?'),
+ self::FIELD_TASK_PRIORITY => pht('Task priority'),
);
}
@@ -284,6 +287,7 @@
case self::FIELD_COMMITTER:
case self::FIELD_REVIEWER:
case self::FIELD_PUSHER:
+ case self::FIELD_TASK_PRIORITY:
return array(
self::CONDITION_IS_ANY,
self::CONDITION_IS_NOT_ANY,
@@ -718,6 +722,8 @@
switch ($field) {
case self::FIELD_REPOSITORY:
return self::VALUE_REPOSITORY;
+ case self::FIELD_TASK_PRIORITY:
+ return self::VALUE_TASK_PRIORITY;
default:
return self::VALUE_USER;
}
@@ -941,6 +947,7 @@
private function renderConditionAsText(
HeraldCondition $condition,
array $handles) {
+
$field_type = $condition->getFieldName();
$field_name = idx($this->getFieldNameMap(), $field_type);
@@ -973,11 +980,24 @@
if (!is_array($value)) {
$value = array($value);
}
- foreach ($value as $index => $val) {
- $handle = idx($handles, $val);
- if ($handle) {
- $value[$index] = $handle->renderLink();
- }
+ switch ($condition->getFieldName()) {
+ case self::FIELD_TASK_PRIORITY:
+ $priority_map = ManiphestTaskPriority::getTaskPriorityMap();
+ foreach ($value as $index => $val) {
+ $name = idx($priority_map, $val);
+ if ($name) {
+ $value[$index] = $name;
+ }
+ }
+ break;
+ default:
+ foreach ($value as $index => $val) {
+ $handle = idx($handles, $val);
+ if ($handle) {
+ $value[$index] = $handle->renderLink();
+ }
+ }
+ break;
}
$value = phutil_implode_html(', ', $value);
return $value;
diff --git a/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php b/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
--- a/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
+++ b/src/applications/herald/adapter/HeraldManiphestTaskAdapter.php
@@ -80,6 +80,7 @@
self::FIELD_CC,
self::FIELD_CONTENT_SOURCE,
self::FIELD_PROJECTS,
+ self::FIELD_TASK_PRIORITY,
self::FIELD_IS_NEW_OBJECT,
),
parent::getFields());
@@ -126,6 +127,8 @@
return $this->getTask()->getCCPHIDs();
case self::FIELD_PROJECTS:
return $this->getTask()->getProjectPHIDs();
+ case self::FIELD_TASK_PRIORITY:
+ return $this->getTask()->getPriority();
}
return parent::getHeraldField($field);
diff --git a/src/applications/herald/controller/HeraldRuleController.php b/src/applications/herald/controller/HeraldRuleController.php
--- a/src/applications/herald/controller/HeraldRuleController.php
+++ b/src/applications/herald/controller/HeraldRuleController.php
@@ -358,14 +358,25 @@
foreach ($rule->getConditions() as $condition) {
$value = $condition->getValue();
- if (is_array($value)) {
- $value_map = array();
- foreach ($value as $k => $fbid) {
- $value_map[$fbid] = $handles[$fbid]->getName();
- }
- $value = $value_map;
+ switch ($condition->getFieldName()) {
+ case HeraldAdapter::FIELD_TASK_PRIORITY:
+ $value_map = array();
+ $priority_map = ManiphestTaskPriority::getTaskPriorityMap();
+ foreach ($value as $priority) {
+ $value_map[$priority] = idx($priority_map, $priority);
+ }
+ $value = $value_map;
+ break;
+ default:
+ if (is_array($value)) {
+ $value_map = array();
+ foreach ($value as $k => $fbid) {
+ $value_map[$fbid] = $handles[$fbid]->getName();
+ }
+ $value = $value_map;
+ }
+ break;
}
-
$serial_conditions[] = array(
$condition->getFieldName(),
$condition->getFieldCondition(),
@@ -574,13 +585,14 @@
return array(
'source' => array(
- 'email' => '/typeahead/common/mailable/',
- 'user' => '/typeahead/common/accounts/',
- 'repository' => '/typeahead/common/repositories/',
- 'package' => '/typeahead/common/packages/',
- 'project' => '/typeahead/common/projects/',
+ 'email' => '/typeahead/common/mailable/',
+ 'user' => '/typeahead/common/accounts/',
+ 'repository' => '/typeahead/common/repositories/',
+ 'package' => '/typeahead/common/packages/',
+ 'project' => '/typeahead/common/projects/',
'userorproject' => '/typeahead/common/accountsorprojects/',
- 'buildplan' => '/typeahead/common/buildplans/',
+ 'buildplan' => '/typeahead/common/buildplans/',
+ 'taskpriority' => '/typeahead/common/taskpriority/',
),
'markup' => $template,
);
diff --git a/src/applications/herald/storage/HeraldRule.php b/src/applications/herald/storage/HeraldRule.php
--- a/src/applications/herald/storage/HeraldRule.php
+++ b/src/applications/herald/storage/HeraldRule.php
@@ -17,7 +17,7 @@
protected $isDisabled = 0;
protected $triggerObjectPHID;
- protected $configVersion = 28;
+ protected $configVersion = 29;
// phids for which this rule has been applied
private $ruleApplied = self::ATTACHABLE;
diff --git a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
--- a/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
+++ b/src/applications/typeahead/controller/PhabricatorTypeaheadCommonDatasourceController.php
@@ -36,6 +36,7 @@
$need_symbols = false;
$need_jump_objects = false;
$need_build_plans = false;
+ $need_task_priority = false;
$need_macros = false;
$need_legalpad_documents = false;
switch ($this->type) {
@@ -99,6 +100,9 @@
case 'buildplans':
$need_build_plans = true;
break;
+ case 'taskpriority':
+ $need_task_priority = true;
+ break;
case 'macros':
$need_macros = true;
break;
@@ -243,6 +247,16 @@
}
}
+ if ($need_task_priority) {
+ $priority_map = ManiphestTaskPriority::getTaskPriorityMap();
+ foreach ($priority_map as $value => $name) {
+ // NOTE: $value is not a phid but is unique. This'll work.
+ $results[] = id(new PhabricatorTypeaheadResult())
+ ->setPHID($value)
+ ->setName($name);
+ }
+ }
+
if ($need_macros) {
$macros = id(new PhabricatorMacroQuery())
->setViewer($viewer)
diff --git a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
--- a/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
+++ b/webroot/rsrc/js/application/herald/HeraldRuleEditor.js
@@ -222,6 +222,7 @@
case 'project':
case 'userorproject':
case 'buildplan':
+ case 'taskpriority':
var tokenizer = this._newTokenizer(type);
input = tokenizer[0];
get_fn = tokenizer[1];

File Metadata

Mime Type
text/plain
Expires
Fri, Sep 20, 12:02 AM (2 h, 30 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6622057
Default Alt Text
D8156.id18454.diff (10 KB)

Event Timeline