Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/controller/HeraldRuleController.php
Show First 20 Lines • Show All 315 Lines • ▼ Show 20 Lines | foreach ($data['actions'] as $action) { | ||||
} | } | ||||
$actions[] = $obj; | $actions[] = $obj; | ||||
} | } | ||||
$rule->attachConditions($conditions); | $rule->attachConditions($conditions); | ||||
$rule->attachActions($actions); | $rule->attachActions($actions); | ||||
if (!$errors) { | if (!$errors) { | ||||
try { | |||||
$edit_action = $rule->getID() ? 'edit' : 'create'; | $edit_action = $rule->getID() ? 'edit' : 'create'; | ||||
$rule->openTransaction(); | $rule->openTransaction(); | ||||
$rule->save(); | $rule->save(); | ||||
$rule->saveConditions($conditions); | $rule->saveConditions($conditions); | ||||
$rule->saveActions($actions); | $rule->saveActions($actions); | ||||
$rule->logEdit($request->getUser()->getPHID(), $edit_action); | $rule->logEdit($request->getUser()->getPHID(), $edit_action); | ||||
$rule->saveTransaction(); | $rule->saveTransaction(); | ||||
} catch (AphrontDuplicateKeyQueryException $ex) { | |||||
$e_name = pht('Not Unique'); | |||||
$errors[] = pht('Rule name is not unique. Choose a unique name.'); | |||||
} | |||||
} | } | ||||
epriestley: Long ago, Herald required each rule name to be unique (sort of). We now have the `Hxx`… | |||||
return array($e_name, $errors); | return array($e_name, $errors); | ||||
} | } | ||||
private function setupEditorBehavior( | private function setupEditorBehavior( | ||||
HeraldRule $rule, | HeraldRule $rule, | ||||
array $handles, | array $handles, | ||||
HeraldAdapter $adapter) { | HeraldAdapter $adapter) { | ||||
▲ Show 20 Lines • Show All 320 Lines • Show Last 20 Lines |
Long ago, Herald required each rule name to be unique (sort of). We now have the Hxx disambiguation and can just drop this.