diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -3670,6 +3670,7 @@ 'PhabricatorCustomFieldInterface', 'PhabricatorDestructibleInterface', 'PhabricatorApplicationTransactionInterface', + 'PhabricatorProjectInterface', ), 'ManiphestTaskDescriptionPreviewController' => 'ManiphestController', 'ManiphestTaskDetailController' => 'ManiphestController', diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php --- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php +++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php @@ -530,52 +530,6 @@ $source)); } - $project_phids = $task->getProjectPHIDs(); - if ($project_phids) { - require_celerity_resource('maniphest-task-summary-css'); - - $positions = id(new PhabricatorProjectColumnPositionQuery()) - ->setViewer($viewer) - ->withBoardPHIDs($project_phids) - ->withObjectPHIDs(array($task->getPHID())) - ->needColumns(true) - ->execute(); - $positions = mpull($positions, null, 'getBoardPHID'); - - $project_handles = array(); - $project_annotations = array(); - foreach ($project_phids as $project_phid) { - $handle = $this->getHandle($project_phid); - $project_handles[] = $handle; - - $position = idx($positions, $project_phid); - if ($position) { - $column = $position->getColumn(); - - $column_name = pht('(%s)', $column->getDisplayName()); - $column_link = phutil_tag( - 'a', - array( - 'href' => $handle->getURI().'board/', - 'class' => 'maniphest-board-link', - ), - $column_name); - - $project_annotations[$project_phid] = array( - ' ', - $column_link); - } - } - - $project_rows = id(new PHUIHandleTagListView()) - ->setHandles($project_handles) - ->setAnnotations($project_annotations); - } else { - $project_rows = phutil_tag('em', array(), pht('None')); - } - - $view->addProperty(pht('Projects'), $project_rows); - $edge_types = array( PhabricatorEdgeConfig::TYPE_TASK_DEPENDED_ON_BY_TASK => pht('Blocks'), diff --git a/src/applications/maniphest/storage/ManiphestTask.php b/src/applications/maniphest/storage/ManiphestTask.php --- a/src/applications/maniphest/storage/ManiphestTask.php +++ b/src/applications/maniphest/storage/ManiphestTask.php @@ -9,7 +9,8 @@ PhrequentTrackableInterface, PhabricatorCustomFieldInterface, PhabricatorDestructibleInterface, - PhabricatorApplicationTransactionInterface { + PhabricatorApplicationTransactionInterface, + PhabricatorProjectInterface { const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; diff --git a/src/applications/project/events/PhabricatorProjectUIEventListener.php b/src/applications/project/events/PhabricatorProjectUIEventListener.php --- a/src/applications/project/events/PhabricatorProjectUIEventListener.php +++ b/src/applications/project/events/PhabricatorProjectUIEventListener.php @@ -42,9 +42,54 @@ $handles = array(); } + // If this object can appear on boards, build the workboard annotations. + // Some day, this might be a generic interface. For now, only tasks can + // appear on boards. + $can_appear_on_boards = ($object instanceof ManiphestTask); + + $annotations = array(); + if ($handles && $can_appear_on_boards) { + + // TDOO: Generalize this UI and move it out of Maniphest. + + require_celerity_resource('maniphest-task-summary-css'); + + $positions = id(new PhabricatorProjectColumnPositionQuery()) + ->setViewer($user) + ->withBoardPHIDs($project_phids) + ->withObjectPHIDs(array($object->getPHID())) + ->needColumns(true) + ->execute(); + $positions = mpull($positions, null, 'getBoardPHID'); + + foreach ($project_phids as $project_phid) { + $handle = $handles[$project_phid]; + + $position = idx($positions, $project_phid); + if ($position) { + $column = $position->getColumn(); + + $column_name = pht('(%s)', $column->getDisplayName()); + $column_link = phutil_tag( + 'a', + array( + 'href' => $handle->getURI().'board/', + 'class' => 'maniphest-board-link', + ), + $column_name); + + $annotations[$project_phid] = array( + ' ', + $column_link); + } + } + + } + if ($handles) { $list = id(new PHUIHandleTagListView()) - ->setHandles($handles); + ->setHandles($handles) + ->setAnnotations($annotations); } else { $list = phutil_tag('em', array(), pht('None')); } diff --git a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php --- a/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php +++ b/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php @@ -1959,18 +1959,10 @@ $has_support = true; } - // TODO: The Maniphest legacy stuff should get cleaned up here. - - if (($object instanceof ManiphestTask) || - ($object instanceof PhabricatorProjectInterface)) { - - if ($object instanceof PhabricatorProjectInterface) { - $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( - $object->getPHID(), - PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); - } else { - $project_phids = $object->getProjectPHIDs(); - } + if ($object instanceof PhabricatorProjectInterface) { + $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( + $object->getPHID(), + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); if ($project_phids) { $watcher_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER;