Fix an issue where newly created tasks could appear at the bottom of columns

Summary:
Ref T10349. At HEAD, if you create a task //on a board//, it floats to the top correctly.

If you create a task elsewhere and tag it with the board, you were subject to the whims of the layout engine and it would generally end up on the bottom.

Instead, make the rules consistent so that "virtual" positions (of tasks which haven't been committed to a particular position yet) still float to the top.

Test Plan:
  - Created tasks from a board.
  - Created tasks from Maniphest, then looked at them on a board.
  - Moved tasks around.
  - In all cases, newly created tasks floated to the top.
  - Sorted by natural and priority.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10349

Differential Revision: https://secure.phabricator.com/D15276
This commit is contained in:
epriestley
2016-02-15 14:43:20 -08:00
parent 53b963efdb
commit e4690a3854
4 changed files with 39 additions and 13 deletions

View File

@@ -124,10 +124,14 @@ final class PhabricatorProjectBoardViewController
$board_phid = $project->getPHID();
// Regardless of display order, pass tasks to the layout engine in ID order
// so layout is consistent.
$board_tasks = msort($tasks, 'getID');
$layout_engine = id(new PhabricatorBoardLayoutEngine())
->setViewer($viewer)
->setBoardPHIDs(array($board_phid))
->setObjectPHIDs(array_keys($tasks))
->setObjectPHIDs(array_keys($board_tasks))
->setFetchAllBoards(true)
->executeLayout();