Support natural ordering of workboards
Summary: Ref T4807. This is probably a complete fix, but I'd be surprised if there isn't a little cleanup I missed. When users drag tasks on a "natural"-ordered workboard, leave things where they put them. This isn't //too// bad since a lot of the existing work is completely reusable (e.g., we don't need any new JS). Test Plan: - Dragged a bunch of stuff around, it stayed where I put it after dropped and when reloaded. - Dragged stuff across priorities, no zany priority changes (in "natural" mode). - Created new tasks, they show up at the top. - Tagged new tasks, they show up at the top of backlog. - Swapped to "priority" mode and got sorting and the old priority-altering reordering. - Added tasks in priority mode. - Viewed task transactions for correctness/sanity. Reviewers: btrahan, chad Reviewed By: chad Subscribers: chad, epriestley Maniphest Tasks: T4807 Differential Revision: https://secure.phabricator.com/D10182
This commit is contained in:
@@ -387,10 +387,23 @@ final class ManiphestTaskEditController extends ManiphestController {
|
||||
->withPHIDs($task_phids)
|
||||
->execute();
|
||||
|
||||
$sort_map = mpull(
|
||||
$column_tasks,
|
||||
'getPrioritySortVector',
|
||||
'getPHID');
|
||||
if ($order == PhabricatorProjectColumn::ORDER_NATURAL) {
|
||||
// TODO: This is a little bit awkward, because PHP and JS use
|
||||
// slightly different sort order parameters to achieve the same
|
||||
// effect. It would be unify this a bit at some point.
|
||||
$sort_map = array();
|
||||
foreach ($positions as $position) {
|
||||
$sort_map[$position->getObjectPHID()] = array(
|
||||
-$position->getSequence(),
|
||||
$position->getID(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$sort_map = mpull(
|
||||
$column_tasks,
|
||||
'getPrioritySortVector',
|
||||
'getPHID');
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'sortMap' => $sort_map,
|
||||
|
||||
Reference in New Issue
Block a user