Differential D8358 Diff 19871 src/applications/maniphest/controller/ManiphestSubpriorityController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/controller/ManiphestSubpriorityController.php
Show All 35 Lines | if ($request->getInt('after')) { | ||||
} | } | ||||
$after_pri = $after_task->getPriority(); | $after_pri = $after_task->getPriority(); | ||||
$after_sub = $after_task->getSubpriority(); | $after_sub = $after_task->getSubpriority(); | ||||
} else { | } else { | ||||
$after_pri = $request->getInt('priority'); | $after_pri = $request->getInt('priority'); | ||||
$after_sub = null; | $after_sub = null; | ||||
} | } | ||||
$new_sub = ManiphestTransactionEditor::getNextSubpriority( | $xactions = array(id(new ManiphestTransaction()) | ||||
$after_pri, | ->setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY) | ||||
$after_sub); | ->setNewValue(array( | ||||
'newPriority' => $after_pri, | |||||
$task->setSubpriority($new_sub); | 'newSubpriorityBase' => $after_sub))); | ||||
epriestley: (Maybe consider calling these something more substantive since they're being saved now.) | |||||
if ($after_pri != $task->getPriority()) { | |||||
$xactions = array(); | |||||
$xactions[] = id(new ManiphestTransaction()) | |||||
->setTransactionType(ManiphestTransaction::TYPE_PRIORITY) | |||||
->setNewValue($after_pri); | |||||
$editor = id(new ManiphestTransactionEditor()) | $editor = id(new ManiphestTransactionEditor()) | ||||
->setActor($user) | ->setActor($user) | ||||
->setContinueOnMissingFields(true) | ->setContinueOnMissingFields(true) | ||||
->setContinueOnNoEffect(true) | ->setContinueOnNoEffect(true) | ||||
->setContentSourceFromRequest($request); | ->setContentSourceFromRequest($request); | ||||
$editor->applyTransactions($task, $xactions); | $editor->applyTransactions($task, $xactions); | ||||
} else { | |||||
$task->save(); | |||||
} | |||||
return id(new AphrontAjaxResponse())->setContent( | return id(new AphrontAjaxResponse())->setContent( | ||||
array( | array( | ||||
'tasks' => $this->renderSingleTask($task), | 'tasks' => $this->renderSingleTask($task), | ||||
)); | )); | ||||
} | } | ||||
} | } |
(Maybe consider calling these something more substantive since they're being saved now.)