Persist column membership after tasks are dragged around

Summary: Ref T1344. Write edges and read them when reloading the board.

Test Plan: After reload, stuff stays mostly where I put it. In-column order isn't always persisted correctly yet.

Reviewers: chad, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T1344

Differential Revision: https://secure.phabricator.com/D7944
This commit is contained in:
epriestley
2014-01-13 12:24:50 -08:00
parent 35d37df4fb
commit bc9326adbc
3 changed files with 109 additions and 3 deletions

View File

@@ -54,11 +54,23 @@ final class PhabricatorProjectBoardController
->execute();
$tasks = mpull($tasks, null, 'getPHID');
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_COLUMN;
$edge_query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(mpull($tasks, 'getPHID'))
->withEdgeTypes(array($edge_type))
->withDestinationPHIDs(mpull($columns, 'getPHID'));
$edge_query->execute();
$task_map = array();
$default_phid = $columns[0]->getPHID();
foreach ($tasks as $task) {
$task_map[$default_phid][] = $task->getPHID();
$task_phid = $task->getPHID();
$column_phids = $edge_query->getDestinationPHIDs(array($task_phid));
$column_phid = head($column_phids);
$column_phid = nonempty($column_phid, $default_phid);
$task_map[$column_phid][] = $task_phid;
}
$board_id = celerity_generate_unique_node_id();