Differential D20417 Diff 48761 src/applications/project/trigger/PhabricatorProjectTriggerManiphestPriorityRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/trigger/PhabricatorProjectTriggerManiphestPriorityRule.php
| <?php | <?php | ||||
| final class PhabricatorProjectTriggerManiphestPriorityRule | final class PhabricatorProjectTriggerManiphestPriorityRule | ||||
| extends PhabricatorProjectTriggerRule { | extends PhabricatorProjectTriggerRule { | ||||
| const TRIGGERTYPE = 'task.priority'; | const TRIGGERTYPE = 'task.priority'; | ||||
| public function getSelectControlName() { | public function getSelectControlName() { | ||||
| return pht('Change priority to'); | return pht('Change priority to'); | ||||
| } | } | ||||
| protected function assertValidRuleValue($value) { | protected function assertValidRuleRecordFormat($value) { | ||||
| if (!is_string($value)) { | if (!is_string($value)) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'Priority rule value should be a string, but is not (value is "%s").', | 'Priority rule value should be a string, but is not (value is "%s").', | ||||
| phutil_describe_type($value))); | phutil_describe_type($value))); | ||||
| } | } | ||||
| } | |||||
| protected function assertValidRuleRecordValue($value) { | |||||
| $map = ManiphestTaskPriority::getTaskPriorityMap(); | $map = ManiphestTaskPriority::getTaskPriorityMap(); | ||||
| if (!isset($map[$value])) { | if (!isset($map[$value])) { | ||||
| throw new Exception( | throw new Exception( | ||||
| pht( | pht( | ||||
| 'Rule value ("%s") is not a valid task priority.', | 'Task priority value ("%s") is not a valid task priority. '. | ||||
| $value)); | 'Valid priorities are: %s.', | ||||
| $value, | |||||
| implode(', ', array_keys($map)))); | |||||
| } | } | ||||
| } | } | ||||
| protected function newDropTransactions($object, $value) { | protected function newDropTransactions($object, $value) { | ||||
| $value = ManiphestTaskPriority::getKeywordForTaskPriority($value); | $value = ManiphestTaskPriority::getKeywordForTaskPriority($value); | ||||
| return array( | return array( | ||||
| $this->newTransaction() | $this->newTransaction() | ||||
| ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) | ->setTransactionType(ManiphestTaskPriorityTransaction::TRANSACTIONTYPE) | ||||
| ▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines | |||||