Differential D8358 Diff 19871 src/applications/project/controller/PhabricatorProjectMoveController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/controller/PhabricatorProjectMoveController.php
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | public function processRequest() { | ||||
$edge_phids = $query->getDestinationPHIDs(); | $edge_phids = $query->getDestinationPHIDs(); | ||||
$this->rewriteEdges( | $this->rewriteEdges( | ||||
$object->getPHID(), | $object->getPHID(), | ||||
$edge_type, | $edge_type, | ||||
$column_phid, | $column_phid, | ||||
$edge_phids); | $edge_phids); | ||||
// TODO: We also need to deal with priorities, so far this only gets stuff | if ($after_phid) { | ||||
// in the correct column. | $after_task = id(new ManiphestTaskQuery()) | ||||
->setViewer($viewer) | |||||
->withPHIDs(array($after_phid)) | |||||
->requireCapabilities(array(PhabricatorPolicyCapability::CAN_EDIT)) | |||||
epriestley: We should `requireCapabilities(...)` with CAN_EDIT here, so you can't reprioritize a task you… | |||||
->executeOne(); | |||||
Not Done Inline Actionswasn't sure what do to if we couldn't find the task via the afterPHID. btrahan: wasn't sure what do to if we couldn't find the task via the afterPHID. | |||||
Not Done Inline ActionsI think 404'ing would be okay, but this isn't bad. Shouldn't ever happen in practice. epriestley: I think 404'ing would be okay, but this isn't bad. Shouldn't ever happen in practice. | |||||
if (!$after_task) { | |||||
return new Aphront404Response(); | |||||
} | |||||
$after_pri = $after_task->getPriority(); | |||||
$after_sub = $after_task->getSubpriority(); | |||||
$xactions = array(id(new ManiphestTransaction()) | |||||
->setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY) | |||||
->setNewValue(array( | |||||
'newPriority' => $after_pri, | |||||
'newSubpriorityBase' => $after_sub))); | |||||
$editor = id(new ManiphestTransactionEditor()) | |||||
->setActor($viewer) | |||||
->setContinueOnMissingFields(true) | |||||
->setContinueOnNoEffect(true) | |||||
->setContentSourceFromRequest($request); | |||||
$editor->applyTransactions($object, $xactions); | |||||
} | |||||
return id(new AphrontAjaxResponse())->setContent(array()); | return id(new AphrontAjaxResponse())->setContent(array()); | ||||
} | } | ||||
private function rewriteEdges($src, $edge_type, $dst, array $edges) { | private function rewriteEdges($src, $edge_type, $dst, array $edges) { | ||||
$viewer = $this->getRequest()->getUser(); | $viewer = $this->getRequest()->getUser(); | ||||
// NOTE: Normally, we expect only one edge to exist, but this works in a | // NOTE: Normally, we expect only one edge to exist, but this works in a | ||||
Show All 36 Lines |
We should requireCapabilities(...) with CAN_EDIT here, so you can't reprioritize a task you don't have permission to edit.
(Exactly how edit permissions shake out here are a little funky right now, but I think you'll need VIEW on the project and EDIT on the task in the long run to drag stuff around.)