Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/editor/ManiphestEditEngine.php
| Show First 20 Lines • Show All 274 Lines • ▼ Show 20 Lines | private function buildCardResponse(ManiphestTask $task) { | ||||
| $column = id(new PhabricatorProjectColumnQuery()) | $column = id(new PhabricatorProjectColumnQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withPHIDs(array($column_phid)) | ->withPHIDs(array($column_phid)) | ||||
| ->executeOne(); | ->executeOne(); | ||||
| if (!$column) { | if (!$column) { | ||||
| return new Aphront404Response(); | return new Aphront404Response(); | ||||
| } | } | ||||
| // If the workboard's project has been removed from the card's project | // If the workboard's project and all descendant projects have been removed | ||||
| // list, we are going to remove it from the board completely. | // from the card's project list, we are going to remove it from the board | ||||
| // completely. | |||||
| // TODO: If the user did something sneaky and changed a subproject, we'll | |||||
| // currently leave the card where it was but should really move it to the | |||||
| // proper new column. | |||||
| $descendant_projects = id(new PhabricatorProjectQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->withAncestorProjectPHIDs(array($column->getProjectPHID())) | |||||
| ->execute(); | |||||
| $board_phids = mpull($descendant_projects, 'getPHID', 'getPHID'); | |||||
| $board_phids[$column->getProjectPHID()] = $column->getProjectPHID(); | |||||
| $project_map = array_fuse($task->getProjectPHIDs()); | $project_map = array_fuse($task->getProjectPHIDs()); | ||||
| $remove_card = empty($project_map[$column->getProjectPHID()]); | $remove_card = !array_intersect_key($board_phids, $project_map); | ||||
| $positions = id(new PhabricatorProjectColumnPositionQuery()) | $positions = id(new PhabricatorProjectColumnPositionQuery()) | ||||
| ->setViewer($viewer) | ->setViewer($viewer) | ||||
| ->withBoardPHIDs(array($column->getProjectPHID())) | ->withBoardPHIDs(array($column->getProjectPHID())) | ||||
| ->withColumnPHIDs(array($column->getPHID())) | ->withColumnPHIDs(array($column->getPHID())) | ||||
| ->execute(); | ->execute(); | ||||
| $task_phids = mpull($positions, 'getObjectPHID'); | $task_phids = mpull($positions, 'getObjectPHID'); | ||||
| ▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines | |||||