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 @@ +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); + } + } + +}