Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3297913
D25913.1742993105.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
3 KB
Referenced Files
None
Subscribers
None
D25913.1742993105.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
@@ -5899,6 +5899,7 @@
'RemarkupValue' => 'applications/remarkup/RemarkupValue.php',
'RepositoryConduitAPIMethod' => 'applications/repository/conduit/RepositoryConduitAPIMethod.php',
'RepositoryQueryConduitAPIMethod' => 'applications/repository/conduit/RepositoryQueryConduitAPIMethod.php',
+ 'SetSubtypeHeraldAction' => 'applications/maniphest/herald/SetSubtypeHeraldAction.php',
'ShellLogView' => 'applications/harbormaster/view/ShellLogView.php',
'SlowvoteConduitAPIMethod' => 'applications/slowvote/conduit/SlowvoteConduitAPIMethod.php',
'SlowvoteEmbedView' => 'applications/slowvote/view/SlowvoteEmbedView.php',
@@ -12836,6 +12837,7 @@
'RemarkupValue' => 'Phobject',
'RepositoryConduitAPIMethod' => 'ConduitAPIMethod',
'RepositoryQueryConduitAPIMethod' => 'RepositoryConduitAPIMethod',
+ 'SetSubtypeHeraldAction' => 'HeraldAction',
'ShellLogView' => 'AphrontView',
'SlowvoteConduitAPIMethod' => 'ConduitAPIMethod',
'SlowvoteEmbedView' => 'AphrontView',
diff --git a/src/applications/maniphest/herald/SetSubtypeHeraldAction.php b/src/applications/maniphest/herald/SetSubtypeHeraldAction.php
new file mode 100644
--- /dev/null
+++ b/src/applications/maniphest/herald/SetSubtypeHeraldAction.php
@@ -0,0 +1,74 @@
+<?php
+
+final class SetSubtypeHeraldAction extends HeraldAction {
+ const ACTIONCONST = 'maniphest.subtype';
+ const DO_SUBTYPE = 'do.subtype';
+
+ public function getActionGroupKey() {
+ return HeraldApplicationActionGroup::ACTIONGROUPKEY;
+ }
+
+ public function supportsObject($object) {
+ return $object instanceof ManiphestTask;
+ }
+
+ public function supportsRuleType($rule_type) {
+ return $rule_type == HeraldRuleTypeConfig::RULE_TYPE_GLOBAL;
+ }
+
+ public function getActionKey() {
+ return self::ACTIONCONST;
+ }
+
+ public function getHeraldActionName() {
+ return pht('Change subtype to');
+ }
+
+ public function renderActionDescription($value) {
+ $type = head($value);
+ return pht('Change subtype to "%s"', $type);
+ }
+
+ public function getHeraldActionStandardType() {
+ return self::STANDARD_PHID_LIST;
+ }
+
+ protected function getDatasource() {
+ return id(new ManiphestTaskSubtypeDatasource())
+ ->setLimit(1);
+ }
+
+ protected function getDatasourceValueMap() {
+ $map = id(new ManiphestTask())->newEditEngineSubtypeMap();
+ return $map->getSubtypes();
+ }
+
+ public function applyEffect($object, HeraldEffect $effect) {
+ $new_subtype = head($effect->getTarget());
+
+ $adapter = $this->getAdapter();
+ $adapter->queueTransaction(id(new ManiphestTransaction())
+ ->setTransactionType(PhabricatorTransactions::TYPE_SUBTYPE)
+ ->setNewValue($new_subtype));
+
+ $this->logEffect(self::DO_SUBTYPE, $new_subtype);
+ }
+
+ protected function getActionEffectMap() {
+ return array(
+ self::DO_SUBTYPE => array(
+ 'icon' => 'fa-pencil',
+ 'color' => 'green',
+ 'name' => pht('Changed Subtype'),
+ ),
+ );
+ }
+
+ protected function renderActionEffectDescription($type, $data) {
+ switch ($type) {
+ case self::DO_SUBTYPE:
+ return pht('Change subtype to "%s."', $data);
+ }
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 26, 12:45 (11 m, 10 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1260373
Default Alt Text
D25913.1742993105.diff (3 KB)
Attached To
Mode
D25913: Herald actions: Allow setting subtype on Maniphest tasks
Attached
Detach File
Event Timeline
Log In to Comment