1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-28 09:42:41 +01:00
phorge-phorge/src/applications/maniphest/herald/ManiphestTaskAssignOtherHeraldAction.php
epriestley bc331f0fbf Allow "Assign task" Herald Action in Maniphest to accept "None" to unassign
Summary:
Fixes T9206. This was also blocked on tokenizers being weird.

Also clean up some rendering stuff from the earlier changes.

Test Plan:
  - Added an "unassign" rule by typing "None", per instructions in the placeholder text.
  - Ran the rule.
  - Task got unassigned.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T9206

Differential Revision: https://secure.phabricator.com/D14684
2015-12-05 12:39:45 -08:00

38 lines
1 KiB
PHP

<?php
final class ManiphestTaskAssignOtherHeraldAction
extends ManiphestTaskAssignHeraldAction {
const ACTIONCONST = 'maniphest.assign.other';
public function getHeraldActionName() {
return pht('Assign task to');
}
public function supportsRuleType($rule_type) {
return ($rule_type != HeraldRuleTypeConfig::RULE_TYPE_PERSONAL);
}
public function applyEffect($object, HeraldEffect $effect) {
return $this->applyAssign($effect->getTarget());
}
public function getHeraldActionStandardType() {
return self::STANDARD_PHID_LIST;
}
protected function getDatasource() {
// TODO: Eventually, it would be nice to get "limit = 1" exported from here
// up to the UI.
return new ManiphestAssigneeDatasource();
}
public function renderActionDescription($value) {
if (head($value) === PhabricatorPeopleNoOwnerDatasource::FUNCTION_TOKEN) {
return pht('Unassign task.');
} else {
return pht('Assign task to: %s.', $this->renderHandleList($value));
}
}
}