Differential D20288 Diff 48427 src/applications/project/trigger/PhabricatorProjectTriggerStatusRule.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/trigger/PhabricatorProjectTriggerStatusRule.php
- This file was added.
<?php | |||||
final class PhabricatorProjectTriggerStatusRule | |||||
amckinley: Shouldn't this be `PhabricatorProjectTriggerManiphestStatusRule`? I know that Maniphest is the… | |||||
epriestleyAuthorUnsubmitted Done Inline ActionsYeah, this is probably a good idea. I'm sort of unsure we'll ever actually generalize, but no reason to make it harder than needbe. epriestley: Yeah, this is probably a good idea. I'm sort of unsure we'll ever actually generalize, but no… | |||||
extends PhabricatorProjectTriggerRule { | |||||
const TRIGGERTYPE = '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), | |||||
); | |||||
} | |||||
} |
Shouldn't this be PhabricatorProjectTriggerManiphestStatusRule? I know that Maniphest is the only application that has workboards and could therefore have columns and triggers, but wasn't it somewhere in the planning docs that we want to keep this appropriately generalizable?