diff --git a/src/applications/maniphest/editor/ManiphestEditEngine.php b/src/applications/maniphest/editor/ManiphestEditEngine.php index b7e3cee965..058a8a98b6 100644 --- a/src/applications/maniphest/editor/ManiphestEditEngine.php +++ b/src/applications/maniphest/editor/ManiphestEditEngine.php @@ -294,6 +294,7 @@ final class ManiphestEditEngine $column_tasks = id(new ManiphestTaskQuery()) ->setViewer($viewer) ->withPHIDs($task_phids) + ->needProjectPHIDs(true) ->execute(); if ($order == PhabricatorProjectColumn::ORDER_NATURAL) { @@ -333,6 +334,7 @@ final class ManiphestEditEngine ->setViewer($viewer) ->setTask($task) ->setOwner($owner) + ->setProject($column->getProject()) ->setCanEdit(true) ->getItem(); diff --git a/src/applications/phid/view/PHUIHandleTagListView.php b/src/applications/phid/view/PHUIHandleTagListView.php index 73cbef2350..0bbfc4d249 100644 --- a/src/applications/phid/view/PHUIHandleTagListView.php +++ b/src/applications/phid/view/PHUIHandleTagListView.php @@ -9,7 +9,7 @@ final class PHUIHandleTagListView extends AphrontTagView { private $slim; private $showHovercards; - public function setHandles(array $handles) { + public function setHandles($handles) { $this->handles = $handles; return $this; } diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php index 4d83ca6fa3..2c064eaf71 100644 --- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php +++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php @@ -304,6 +304,7 @@ final class PhabricatorProjectBoardViewController $can_edit = idx($task_can_edit_map, $task->getPHID(), false); $cards->addItem(id(new ProjectBoardTaskCard()) ->setViewer($viewer) + ->setProject($project) ->setTask($task) ->setOwner($owner) ->setCanEdit($can_edit) diff --git a/src/applications/project/controller/PhabricatorProjectMoveController.php b/src/applications/project/controller/PhabricatorProjectMoveController.php index 1b2429917c..3fc72e7341 100644 --- a/src/applications/project/controller/PhabricatorProjectMoveController.php +++ b/src/applications/project/controller/PhabricatorProjectMoveController.php @@ -26,9 +26,10 @@ final class PhabricatorProjectMoveController return new Aphront404Response(); } - $object = id(new PhabricatorObjectQuery()) + $object = id(new ManiphestTaskQuery()) ->setViewer($viewer) ->withPHIDs(array($object_phid)) + ->needProjectPHIDs(true) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, @@ -95,6 +96,7 @@ final class PhabricatorProjectMoveController $tasks = id(new ManiphestTaskQuery()) ->setViewer($viewer) ->withPHIDs($task_phids) + ->needProjectPHIDs(true) ->requireCapabilities( array( PhabricatorPolicyCapability::CAN_VIEW, @@ -149,11 +151,13 @@ final class PhabricatorProjectMoveController ->withPHIDs(array($object->getOwnerPHID())) ->executeOne(); } + $card = id(new ProjectBoardTaskCard()) ->setViewer($viewer) ->setTask($object) ->setOwner($owner) ->setCanEdit(true) + ->setProject($project) ->getItem(); return id(new AphrontAjaxResponse())->setContent( diff --git a/src/applications/project/view/ProjectBoardTaskCard.php b/src/applications/project/view/ProjectBoardTaskCard.php index 4fc26988d7..9ae3ef83c8 100644 --- a/src/applications/project/view/ProjectBoardTaskCard.php +++ b/src/applications/project/view/ProjectBoardTaskCard.php @@ -3,6 +3,7 @@ final class ProjectBoardTaskCard extends Phobject { private $viewer; + private $project; private $task; private $owner; private $canEdit; @@ -15,6 +16,14 @@ final class ProjectBoardTaskCard extends Phobject { return $this->viewer; } + public function setProject(PhabricatorProject $project) { + $this->project = $project; + return $this; + } + public function getProject() { + return $this->project; + } + public function setTask(ManiphestTask $task) { $this->task = $task; return $this; @@ -44,13 +53,14 @@ final class ProjectBoardTaskCard extends Phobject { $task = $this->getTask(); $owner = $this->getOwner(); $can_edit = $this->getCanEdit(); + $viewer = $this->getViewer(); $color_map = ManiphestTaskPriority::getColorMap(); $bar_color = idx($color_map, $task->getPriority(), 'grey'); $card = id(new PHUIObjectItemView()) ->setObject($task) - ->setUser($this->getViewer()) + ->setUser($viewer) ->setObjectName('T'.$task->getID()) ->setHeader($task->getTitle()) ->setGrippable($can_edit) @@ -73,6 +83,18 @@ final class ProjectBoardTaskCard extends Phobject { $card->addAttribute($owner->renderLink()); } + $project_phids = array_fuse($task->getProjectPHIDs()); + unset($project_phids[$this->project->getPHID()]); + + $handle_list = $viewer->loadHandles($project_phids); + $tag_list = id(new PHUIHandleTagListView()) + ->setSlim(true) + ->setHandles($handle_list); + + if (!$tag_list->isEmpty()) { + $card->addAttribute($tag_list); + } + return $card; } diff --git a/src/view/AphrontTagView.php b/src/view/AphrontTagView.php index a6eb722383..b82ebef9c3 100644 --- a/src/view/AphrontTagView.php +++ b/src/view/AphrontTagView.php @@ -77,6 +77,10 @@ abstract class AphrontTagView extends AphrontView { return $this->id; } + public function isEmpty() { + return empty($this->getTagContent()); + } + protected function getTagName() { return 'div'; }