mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-23 07:12:41 +01:00
When creating or editing a card on a sorted/grouped workboard, adjust headers appropriately
Summary: Depends on D20270. Ref T10333. If you create a task with a new owner, or edit a task and change the priority/owner, we want to move it (and possibly create a new header) when the response comes back. Make sure the response includes the appropriate details about the object's header and position. Test Plan: - Grouped by Owner. - Created a new task with a new owner, saw the header appear. - Edited a task and changed it to give it a new owner, saw the header appear. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T10333 Differential Revision: https://secure.phabricator.com/D20271
This commit is contained in:
parent
2fdab434fa
commit
21dd79b35a
2 changed files with 22 additions and 45 deletions
|
@ -37,29 +37,6 @@ abstract class ManiphestController extends PhabricatorController {
|
||||||
return $crumbs;
|
return $crumbs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderSingleTask(ManiphestTask $task) {
|
|
||||||
$request = $this->getRequest();
|
|
||||||
$user = $request->getUser();
|
|
||||||
|
|
||||||
$phids = $task->getProjectPHIDs();
|
|
||||||
if ($task->getOwnerPHID()) {
|
|
||||||
$phids[] = $task->getOwnerPHID();
|
|
||||||
}
|
|
||||||
|
|
||||||
$handles = id(new PhabricatorHandleQuery())
|
|
||||||
->setViewer($user)
|
|
||||||
->withPHIDs($phids)
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
$view = id(new ManiphestTaskListView())
|
|
||||||
->setUser($user)
|
|
||||||
->setShowBatchControls(true)
|
|
||||||
->setHandles($handles)
|
|
||||||
->setTasks(array($task));
|
|
||||||
|
|
||||||
return $view;
|
|
||||||
}
|
|
||||||
|
|
||||||
final protected function newTaskGraphDropdownMenu(
|
final protected function newTaskGraphDropdownMenu(
|
||||||
ManiphestTask $task,
|
ManiphestTask $task,
|
||||||
$has_parents,
|
$has_parents,
|
||||||
|
|
|
@ -379,7 +379,10 @@ EODOCS
|
||||||
$object,
|
$object,
|
||||||
array $xactions) {
|
array $xactions) {
|
||||||
|
|
||||||
if ($request->isAjax()) {
|
$response_type = $request->getStr('responseType');
|
||||||
|
$is_card = ($response_type === 'card');
|
||||||
|
|
||||||
|
if ($is_card) {
|
||||||
// Reload the task to make sure we pick up the final task state.
|
// Reload the task to make sure we pick up the final task state.
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
$task = id(new ManiphestTaskQuery())
|
$task = id(new ManiphestTaskQuery())
|
||||||
|
@ -389,29 +392,12 @@ EODOCS
|
||||||
->needProjectPHIDs(true)
|
->needProjectPHIDs(true)
|
||||||
->executeOne();
|
->executeOne();
|
||||||
|
|
||||||
switch ($request->getStr('responseType')) {
|
return $this->buildCardResponse($task);
|
||||||
case 'card':
|
|
||||||
return $this->buildCardResponse($task);
|
|
||||||
default:
|
|
||||||
return $this->buildListResponse($task);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::newEditResponse($request, $object, $xactions);
|
return parent::newEditResponse($request, $object, $xactions);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildListResponse(ManiphestTask $task) {
|
|
||||||
$controller = $this->getController();
|
|
||||||
|
|
||||||
$payload = array(
|
|
||||||
'tasks' => $controller->renderSingleTask($task),
|
|
||||||
'data' => array(),
|
|
||||||
);
|
|
||||||
|
|
||||||
return id(new AphrontAjaxResponse())->setContent($payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function buildCardResponse(ManiphestTask $task) {
|
private function buildCardResponse(ManiphestTask $task) {
|
||||||
$controller = $this->getController();
|
$controller = $this->getController();
|
||||||
$request = $controller->getRequest();
|
$request = $controller->getRequest();
|
||||||
|
@ -435,12 +421,26 @@ EODOCS
|
||||||
$board_phid = $column->getProjectPHID();
|
$board_phid = $column->getProjectPHID();
|
||||||
$object_phid = $task->getPHID();
|
$object_phid = $task->getPHID();
|
||||||
|
|
||||||
return id(new PhabricatorBoardResponseEngine())
|
$order = $request->getStr('order');
|
||||||
|
if ($order) {
|
||||||
|
$ordering = PhabricatorProjectColumnOrder::getOrderByKey($order);
|
||||||
|
$ordering = id(clone $ordering)
|
||||||
|
->setViewer($viewer);
|
||||||
|
} else {
|
||||||
|
$ordering = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$engine = id(new PhabricatorBoardResponseEngine())
|
||||||
->setViewer($viewer)
|
->setViewer($viewer)
|
||||||
->setBoardPHID($board_phid)
|
->setBoardPHID($board_phid)
|
||||||
->setObjectPHID($object_phid)
|
->setObjectPHID($object_phid)
|
||||||
->setVisiblePHIDs($visible_phids)
|
->setVisiblePHIDs($visible_phids);
|
||||||
->buildResponse();
|
|
||||||
|
if ($ordering) {
|
||||||
|
$engine->setOrdering($ordering);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $engine->buildResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getColumnMap(ManiphestTask $task) {
|
private function getColumnMap(ManiphestTask $task) {
|
||||||
|
|
Loading…
Reference in a new issue