Differential D20288 Diff 48496 src/applications/project/trigger/PhabricatorProjectTriggerManiphestStatusRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/trigger/PhabricatorProjectTriggerManiphestStatusRule.php
- This file was added.
| <?php | |||||
| final class PhabricatorProjectTriggerManiphestStatusRule | |||||
| extends PhabricatorProjectTriggerRule { | |||||
| const TRIGGERTYPE = 'task.status'; | |||||
| public function getDescription() { | |||||
| $value = $this->getValue(); | |||||
| return pht( | |||||
| 'Changes status to "%s".', | |||||
| ManiphestTaskStatus::getTaskStatusName($value)); | |||||
| } | |||||
| protected function assertValidRuleValue($value) { | |||||
| if (!is_string($value)) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'Status rule value should be a string, but is not (value is "%s").', | |||||
| phutil_describe_type($value))); | |||||
| } | |||||
| $map = ManiphestTaskStatus::getTaskStatusMap(); | |||||
| if (!isset($map[$value])) { | |||||
| throw new Exception( | |||||
| pht( | |||||
| 'Rule value ("%s") is not a valid task status.', | |||||
| $value)); | |||||
| } | |||||
| } | |||||
| protected function newDropTransactions($object, $value) { | |||||
| return array( | |||||
| $this->newTransaction() | |||||
| ->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE) | |||||
| ->setNewValue($value), | |||||
| ); | |||||
| } | |||||
| } | |||||