Path: blob/master/src/applications/maniphest/herald/ManiphestTaskAssignHeraldAction.php
12256 views
<?php12abstract class ManiphestTaskAssignHeraldAction3extends HeraldAction {45const DO_ASSIGN = 'do.assign';67public function supportsObject($object) {8return ($object instanceof ManiphestTask);9}1011public function getActionGroupKey() {12return HeraldApplicationActionGroup::ACTIONGROUPKEY;13}1415protected function applyAssign(array $phids) {16$adapter = $this->getAdapter();17$object = $adapter->getObject();1819$current = array($object->getOwnerPHID());2021$allowed_types = array(22PhabricatorPeopleUserPHIDType::TYPECONST,23);2425if (head($phids) == PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) {26$phid = null;2728if ($object->getOwnerPHID() == null) {29$this->logEffect(self::DO_STANDARD_NO_EFFECT);30return;31}32} else {33$targets = $this->loadStandardTargets($phids, $allowed_types, $current);34if (!$targets) {35return;36}3738$phid = head_key($targets);39}4041$xaction = $adapter->newTransaction()42->setTransactionType(ManiphestTaskOwnerTransaction::TRANSACTIONTYPE)43->setNewValue($phid);4445$adapter->queueTransaction($xaction);4647$this->logEffect(self::DO_ASSIGN, array($phid));48}4950protected function getActionEffectMap() {51return array(52self::DO_ASSIGN => array(53'icon' => 'fa-user',54'color' => 'green',55'name' => pht('Assigned Task'),56),57);58}5960protected function renderActionEffectDescription($type, $data) {61switch ($type) {62case self::DO_ASSIGN:63if (head($data) === null) {64return pht('Unassigned task.');65} else {66return pht(67'Assigned task to: %s.',68$this->renderHandleList($data));69}70}71}7273}747576