Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14026449
D14359.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D14359.id.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
@@ -1321,6 +1321,7 @@
'ManiphestTaskStatus' => 'applications/maniphest/constants/ManiphestTaskStatus.php',
'ManiphestTaskStatusDatasource' => 'applications/maniphest/typeahead/ManiphestTaskStatusDatasource.php',
'ManiphestTaskStatusFunctionDatasource' => 'applications/maniphest/typeahead/ManiphestTaskStatusFunctionDatasource.php',
+ 'ManiphestTaskStatusHeraldAction' => 'applications/maniphest/herald/ManiphestTaskStatusHeraldAction.php',
'ManiphestTaskStatusHeraldField' => 'applications/maniphest/herald/ManiphestTaskStatusHeraldField.php',
'ManiphestTaskStatusTestCase' => 'applications/maniphest/constants/__tests__/ManiphestTaskStatusTestCase.php',
'ManiphestTaskTestCase' => 'applications/maniphest/__tests__/ManiphestTaskTestCase.php',
@@ -5313,6 +5314,7 @@
'ManiphestTaskStatus' => 'ManiphestConstants',
'ManiphestTaskStatusDatasource' => 'PhabricatorTypeaheadDatasource',
'ManiphestTaskStatusFunctionDatasource' => 'PhabricatorTypeaheadCompositeDatasource',
+ 'ManiphestTaskStatusHeraldAction' => 'HeraldAction',
'ManiphestTaskStatusHeraldField' => 'ManiphestTaskHeraldField',
'ManiphestTaskStatusTestCase' => 'PhabricatorTestCase',
'ManiphestTaskTestCase' => 'PhabricatorTestCase',
diff --git a/src/applications/maniphest/herald/ManiphestTaskStatusHeraldAction.php b/src/applications/maniphest/herald/ManiphestTaskStatusHeraldAction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/herald/ManiphestTaskStatusHeraldAction.php
@@ -0,0 +1,87 @@
+<?php
+
+final class ManiphestTaskStatusHeraldAction
+ extends HeraldAction {
+
+ const ACTIONCONST = 'maniphest.status';
+ const DO_STATUS = 'do.status';
+
+ public function supportsObject($object) {
+ return ($object instanceof ManiphestTask);
+ }
+
+ public function getActionGroupKey() {
+ return HeraldApplicationActionGroup::ACTIONGROUPKEY;
+ }
+
+ public function getHeraldActionName() {
+ return pht('Change status to');
+ }
+
+ public function supportsRuleType($rule_type) {
+ return ($rule_type != HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
+ }
+
+ public function applyEffect($object, HeraldEffect $effect) {
+ $status = head($effect->getTarget());
+
+ if (!$status) {
+ $this->logEffect(self::DO_STANDARD_EMPTY);
+ return;
+ }
+
+ $adapter = $this->getAdapter();
+ $object = $adapter->getObject();
+ $current = $object->getStatus();
+
+ if ($current == $status) {
+ $this->logEffect(self::DO_STANDARD_NO_EFFECT, $status);
+ return;
+ }
+
+ $xaction = $adapter->newTransaction()
+ ->setTransactionType(ManiphestTransaction::TYPE_STATUS)
+ ->setNewValue($status);
+
+ $adapter->queueTransaction($xaction);
+ $this->logEffect(self::DO_STATUS, $status);
+ }
+
+ public function getHeraldActionStandardType() {
+ return self::STANDARD_PHID_LIST;
+ }
+
+ public function renderActionDescription($value) {
+ $status = head($value);
+ $name = ManiphestTaskStatus::getTaskStatusName($status);
+ return pht('Change status to: %s.', $name);
+ }
+
+ protected function getDatasource() {
+ return new ManiphestTaskStatusDatasource();
+ }
+
+ protected function getDatasourceValueMap() {
+ return ManiphestTaskStatus::getTaskStatusMap();
+ }
+
+ protected function getActionEffectMap() {
+ return array(
+ self::DO_STATUS => array(
+ 'icon' => 'fa-pencil',
+ 'color' => 'green',
+ 'name' => pht('Changed Task Status'),
+ ),
+ );
+ }
+
+ protected function renderActionEffectDescription($type, $data) {
+ switch ($type) {
+ case self::DO_STATUS:
+ return pht(
+ 'Changed task status to "%s".',
+ ManiphestTaskStatus::getTaskStatusName($data));
+ }
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 1:19 AM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6736041
Default Alt Text
D14359.id.diff (3 KB)
Attached To
Mode
D14359: Herald support for changing task status
Attached
Detach File
Event Timeline
Log In to Comment