Differential D20417 Diff 48761 src/applications/project/xaction/trigger/PhabricatorProjectTriggerRulesetTransaction.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/xaction/trigger/PhabricatorProjectTriggerRulesetTransaction.php
Show All 14 Lines | final class PhabricatorProjectTriggerRulesetTransaction | ||||
public function getTitle() { | public function getTitle() { | ||||
return pht( | return pht( | ||||
'%s updated the ruleset for this trigger.', | '%s updated the ruleset for this trigger.', | ||||
$this->renderAuthor()); | $this->renderAuthor()); | ||||
} | } | ||||
public function validateTransactions($object, array $xactions) { | public function validateTransactions($object, array $xactions) { | ||||
$actor = $this->getActor(); | |||||
$errors = array(); | $errors = array(); | ||||
foreach ($xactions as $xaction) { | foreach ($xactions as $xaction) { | ||||
$ruleset = $xaction->getNewValue(); | $ruleset = $xaction->getNewValue(); | ||||
try { | try { | ||||
$rules = | |||||
PhabricatorProjectTrigger::newTriggerRulesFromRuleSpecifications( | PhabricatorProjectTrigger::newTriggerRulesFromRuleSpecifications( | ||||
$ruleset, | $ruleset, | ||||
$allow_invalid = false, | $allow_invalid = false, | ||||
$xaction->getViewer()); | $actor); | ||||
} catch (PhabricatorProjectTriggerCorruptionException $ex) { | } catch (PhabricatorProjectTriggerCorruptionException $ex) { | ||||
$errors[] = $this->newInvalidError( | $errors[] = $this->newInvalidError( | ||||
pht( | pht( | ||||
'Ruleset specification is not valid. %s', | 'Ruleset specification is not valid. %s', | ||||
$ex->getMessage()), | $ex->getMessage()), | ||||
$xaction); | $xaction); | ||||
continue; | continue; | ||||
} | } | ||||
foreach ($rules as $rule) { | |||||
$exception = $rule->getRuleRecordValueValidationException(); | |||||
if ($exception) { | |||||
$errors[] = $this->newInvalidError( | |||||
pht( | |||||
'Value for "%s" rule is invalid: %s', | |||||
$rule->getSelectControlName(), | |||||
$exception->getMessage()), | |||||
$xaction); | |||||
continue; | |||||
amckinley: No-op `continue`. | |||||
} | |||||
} | |||||
} | } | ||||
return $errors; | return $errors; | ||||
} | } | ||||
public function hasChangeDetailView() { | public function hasChangeDetailView() { | ||||
return true; | return true; | ||||
} | } | ||||
Show All 18 Lines |
No-op continue.