private function getPriorityTransactions(ManiphestTask $task, $after_phid, $before_phid) { list($after_task, $before_task) = $this->loadPriorityTasks($after_phid, $before_phid); $must_move = false; if ($after_task && !$task->isLowerPriorityThan($after_task)) { $must_move = true; } if ($before_task && !$task->isHigherPriorityThan($before_task)) { $must_move = true; } // The move doesn't require a priority change to be valid, so don't // change the priority since we are not being forced to. if (!$must_move) { return array(); } $try = array(array($after_task, true), array($before_task, false)); $pri = null; $sub = null; foreach ($try as $spec) { list($task, $is_after) = $spec; if (!$task) { continue; } list($pri, $sub) = ManiphestTransactionEditor::getAdjacentSubpriority($task, $is_after); } $xactions = array(); if ($pri !== null) { $xactions[] = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_PRIORITY)->setNewValue($pri); $xactions[] = id(new ManiphestTransaction())->setTransactionType(ManiphestTransaction::TYPE_SUBPRIORITY)->setNewValue($sub); } return $xactions; }