Nearly complete lifting card-move code out of workboards

Summary: Ref T10010. This gets rid of the last dependency on the weird ColumnPositionQuery code.

Test Plan:
  - Viewed workboards.
  - Used batch editor.
  - Created a new workboard.
  - Dragged stuff around.
  - Created new tasks into columns.
  - Changed order from natural to priority, dragged things around.
  - Switched filter to custom filter, "all tasks", etc.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10010

Differential Revision: https://secure.phabricator.com/D15176
This commit is contained in:
epriestley
2016-02-03 11:58:14 -08:00
parent a9e98e42f5
commit e25a40236f
2 changed files with 125 additions and 148 deletions

View File

@@ -6,7 +6,7 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
private $boardPHIDs;
private $objectPHIDs;
private $boards;
private $columnMap;
private $columnMap = array();
private $objectColumnMap = array();
private $boardLayout = array();
@@ -68,6 +68,17 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
return $this;
}
public function getColumns($board_phid) {
$columns = idx($this->boardLayout, $board_phid, array());
return array_select_keys($this->columnMap, array_keys($columns));
}
public function getColumnObjectPHIDs($board_phid, $column_phid) {
$columns = idx($this->boardLayout, $board_phid, array());
$positions = idx($columns, $column_phid, array());
return mpull($positions, 'getObjectPHID');
}
public function getObjectColumns($board_phid, $object_phid) {
$board_map = idx($this->objectColumnMap, $board_phid, array());
@@ -342,15 +353,16 @@ final class PhabricatorBoardLayoutEngine extends Phobject {
$board_phid = $board->getPHID();
$position_groups = mgroup($positions, 'getObjectPHID');
$layout = array();
foreach ($columns as $column) {
$column_phid = $column->getPHID();
$layout[$column_phid] = array();
if ($column->isDefaultColumn()) {
$default_phid = $column->getPHID();
break;
$default_phid = $column_phid;
}
}
$layout = array();
$object_phids = $this->getObjectPHIDs();
foreach ($object_phids as $object_phid) {
$positions = idx($position_groups, $object_phid, array());