Move board relationships to dedicated storage
Summary: Fixes T5476. Using edges to store which objects are on which board columns ends up being pretty awkward. In particular, it makes T4807 very difficult to implement. Introduce a dedicated `BoardColumnPosition` storage. This doesn't affect ordering rules (T4807) yet: boards are still arranged by priority. We just read which tasks are on which columns out of a new table. Test Plan: - Migrated data, then viewed some boards. Saw exactly the same data. - Dragged tasks from column to column. - Created a task directly into a column. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5476 Differential Revision: https://secure.phabricator.com/D10160
This commit is contained in:
@@ -135,26 +135,28 @@ final class PhabricatorProjectBoardViewController
|
||||
->setOrderBy(ManiphestTaskQuery::ORDER_PRIORITY)
|
||||
->setViewer($viewer)
|
||||
->execute();
|
||||
|
||||
$tasks = mpull($tasks, null, 'getPHID');
|
||||
$task_phids = array_keys($tasks);
|
||||
|
||||
if ($task_phids) {
|
||||
$edge_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_COLUMN;
|
||||
$edge_query = id(new PhabricatorEdgeQuery())
|
||||
->withSourcePHIDs($task_phids)
|
||||
->withEdgeTypes(array($edge_type))
|
||||
->withDestinationPHIDs(mpull($columns, 'getPHID'));
|
||||
$edge_query->execute();
|
||||
if ($tasks) {
|
||||
$positions = id(new PhabricatorProjectColumnPositionQuery())
|
||||
->setViewer($viewer)
|
||||
->withObjectPHIDs(mpull($tasks, 'getPHID'))
|
||||
->withColumns($columns)
|
||||
->execute();
|
||||
$positions = mpull($positions, null, 'getObjectPHID');
|
||||
} else {
|
||||
$positions = array();
|
||||
}
|
||||
|
||||
$task_map = array();
|
||||
$default_phid = $columns[0]->getPHID();
|
||||
foreach ($tasks as $task) {
|
||||
$task_phid = $task->getPHID();
|
||||
$column_phids = $edge_query->getDestinationPHIDs(array($task_phid));
|
||||
|
||||
$column_phid = head($column_phids);
|
||||
$column_phid = null;
|
||||
if (isset($positions[$task_phid])) {
|
||||
$column_phid = $positions[$task_phid]->getColumnPHID();
|
||||
}
|
||||
$column_phid = nonempty($column_phid, $default_phid);
|
||||
|
||||
$task_map[$column_phid][] = $task_phid;
|
||||
|
||||
Reference in New Issue
Block a user