Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14090785
D10842.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D10842.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -1014,6 +1014,7 @@
'ManiphestTaskResultListView' => 'applications/maniphest/view/ManiphestTaskResultListView.php',
'ManiphestTaskSearchEngine' => 'applications/maniphest/query/ManiphestTaskSearchEngine.php',
'ManiphestTaskStatus' => 'applications/maniphest/constants/ManiphestTaskStatus.php',
+ 'ManiphestTaskStatusDatasource' => 'applications/maniphest/typeahead/ManiphestTaskStatusDatasource.php',
'ManiphestTaskStatusTestCase' => 'applications/maniphest/constants/__tests__/ManiphestTaskStatusTestCase.php',
'ManiphestTaskSubscriber' => 'applications/maniphest/storage/ManiphestTaskSubscriber.php',
'ManiphestTransaction' => 'applications/maniphest/storage/ManiphestTransaction.php',
@@ -4073,6 +4074,7 @@
'ManiphestTaskResultListView' => 'ManiphestView',
'ManiphestTaskSearchEngine' => 'PhabricatorApplicationSearchEngine',
'ManiphestTaskStatus' => 'ManiphestConstants',
+ 'ManiphestTaskStatusDatasource' => 'PhabricatorTypeaheadDatasource',
'ManiphestTaskStatusTestCase' => 'PhabricatorTestCase',
'ManiphestTaskSubscriber' => 'ManiphestDAO',
'ManiphestTransaction' => 'PhabricatorApplicationTransaction',
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
@@ -40,6 +40,7 @@
const FIELD_COMMITTER_RAW = 'committer-raw';
const FIELD_IS_NEW_OBJECT = 'new-object';
const FIELD_TASK_PRIORITY = 'taskpriority';
+ const FIELD_TASK_STATUS = 'taskstatus';
const FIELD_ARCANIST_PROJECT = 'arcanist-project';
const FIELD_PUSHER_IS_COMMITTER = 'pusher-is-committer';
const FIELD_PATH = 'path';
@@ -96,6 +97,7 @@
const VALUE_USER_OR_PROJECT = 'userorproject';
const VALUE_BUILD_PLAN = 'buildplan';
const VALUE_TASK_PRIORITY = 'taskpriority';
+ const VALUE_TASK_STATUS = 'taskstatus';
const VALUE_ARCANIST_PROJECT = 'arcanistprojects';
const VALUE_LEGAL_DOCUMENTS = 'legaldocuments';
@@ -311,6 +313,7 @@
self::FIELD_COMMITTER_RAW => pht('Raw committer name'),
self::FIELD_IS_NEW_OBJECT => pht('Is newly created?'),
self::FIELD_TASK_PRIORITY => pht('Task priority'),
+ self::FIELD_TASK_STATUS => pht('Task status'),
self::FIELD_ARCANIST_PROJECT => pht('Arcanist Project'),
self::FIELD_PUSHER_IS_COMMITTER => pht('Pusher same as committer'),
self::FIELD_PATH => pht('Path'),
@@ -366,6 +369,7 @@
case self::FIELD_REVIEWER:
case self::FIELD_PUSHER:
case self::FIELD_TASK_PRIORITY:
+ case self::FIELD_TASK_STATUS:
case self::FIELD_ARCANIST_PROJECT:
return array(
self::CONDITION_IS_ANY,
@@ -843,6 +847,8 @@
return self::VALUE_REPOSITORY;
case self::FIELD_TASK_PRIORITY:
return self::VALUE_TASK_PRIORITY;
+ case self::FIELD_TASK_STATUS:
+ return self::VALUE_TASK_STATUS;
case self::FIELD_ARCANIST_PROJECT:
return self::VALUE_ARCANIST_PROJECT;
default:
@@ -1162,6 +1168,15 @@
}
}
break;
+ case self::FIELD_TASK_STATUS:
+ $status_map = ManiphestTaskStatus::getTaskStatusMap();
+ foreach ($value as $index => $val) {
+ $name = idx($status_map, $val);
+ if ($name) {
+ $value[$index] = $name;
+ }
+ }
+ break;
case HeraldPreCommitRefAdapter::FIELD_REF_CHANGE:
$change_map =
PhabricatorRepositoryPushLog::getHeraldChangeFlagConditionOptions();
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
@@ -89,6 +89,7 @@
self::FIELD_CONTENT_SOURCE,
self::FIELD_PROJECTS,
self::FIELD_TASK_PRIORITY,
+ self::FIELD_TASK_STATUS,
self::FIELD_IS_NEW_OBJECT,
),
parent::getFields());
@@ -145,6 +146,8 @@
PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);
case self::FIELD_TASK_PRIORITY:
return $this->getTask()->getPriority();
+ case self::FIELD_TASK_STATUS:
+ return $this->getTask()->getStatus();
}
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,6 +358,14 @@
}
$value = $value_map;
break;
+ case HeraldAdapter::FIELD_TASK_STATUS:
+ $value_map = array();
+ $status_map = ManiphestTaskStatus::getTaskStatusMap();
+ foreach ($value as $status) {
+ $value_map[$status] = idx($status_map, $status);
+ }
+ $value = $value_map;
+ break;
default:
if (is_array($value)) {
$value_map = array();
@@ -586,6 +594,7 @@
'repository' => new DiffusionRepositoryDatasource(),
'legaldocuments' => new LegalpadDocumentDatasource(),
'taskpriority' => new ManiphestTaskPriorityDatasource(),
+ 'taskstatus' => new ManiphestTaskStatusDatasource(),
'buildplan' => new HarbormasterBuildPlanDatasource(),
'arcanistprojects' => new DiffusionArcanistProjectDatasource(),
'package' => new PhabricatorOwnersPackageDatasource(),
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
@@ -18,7 +18,7 @@
protected $isDisabled = 0;
protected $triggerObjectPHID;
- protected $configVersion = 37;
+ protected $configVersion = 38;
// PHIDs for which this rule has been applied
private $ruleApplied = self::ATTACHABLE;
diff --git a/src/applications/maniphest/typeahead/ManiphestTaskStatusDatasource.php b/src/applications/maniphest/typeahead/ManiphestTaskStatusDatasource.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/typeahead/ManiphestTaskStatusDatasource.php
@@ -0,0 +1,30 @@
+<?php
+
+final class ManiphestTaskStatusDatasource
+ extends PhabricatorTypeaheadDatasource {
+
+ public function getPlaceholderText() {
+ return pht('Type a task status name...');
+ }
+
+ public function getDatasourceApplicationClass() {
+ return 'PhabricatorManiphestApplication';
+ }
+
+ public function loadResults() {
+ $viewer = $this->getViewer();
+ $raw_query = $this->getRawQuery();
+
+ $results = array();
+
+ $status_map = ManiphestTaskStatus::getTaskStatusMap();
+ foreach ($status_map as $value => $name) {
+ // NOTE: $value is not a PHID but is unique. This'll work.
+ $results[] = id(new PhabricatorTypeaheadResult())
+ ->setPHID($value)
+ ->setName($name);
+ }
+
+ return $results;
+ }
+}
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
@@ -219,6 +219,7 @@
case 'userorproject':
case 'buildplan':
case 'taskpriority':
+ case 'taskstatus':
case 'arcanistprojects':
case 'legaldocuments':
var tokenizer = this._newTokenizer(type);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 8:19 PM (20 h, 24 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6786875
Default Alt Text
D10842.diff (7 KB)
Attached To
Mode
D10842: T5015, Allow Herald rules for Maniphest to act on task status changes
Attached
Detach File
Event Timeline
Log In to Comment