mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-23 22:10:55 +01:00
Implement PhabricatorProjectInterface on ManiphestTask
Summary: Ref T5245. This removes some hacks and activates two meaningful interactions: - The "projects" field goes through shared code now. - Mentioning projects in tasks using hashtags now tags them. Test Plan: - Viewed a task with projects. - Viewed a task with no projects. - Viewed a task with projects and board positions. - Viewed a revision with projects. - Made a `#hashtag` comment in Maniphest and got a project association. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T5245 Differential Revision: https://secure.phabricator.com/D10177
This commit is contained in:
parent
3785f8113e
commit
20d8b1bdd3
5 changed files with 53 additions and 60 deletions
|
@ -3670,6 +3670,7 @@ phutil_register_library_map(array(
|
|||
'PhabricatorCustomFieldInterface',
|
||||
'PhabricatorDestructibleInterface',
|
||||
'PhabricatorApplicationTransactionInterface',
|
||||
'PhabricatorProjectInterface',
|
||||
),
|
||||
'ManiphestTaskDescriptionPreviewController' => 'ManiphestController',
|
||||
'ManiphestTaskDetailController' => 'ManiphestController',
|
||||
|
|
|
@ -530,52 +530,6 @@ final class ManiphestTaskDetailController extends ManiphestController {
|
|||
$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'),
|
||||
|
|
|
@ -9,7 +9,8 @@ final class ManiphestTask extends ManiphestDAO
|
|||
PhrequentTrackableInterface,
|
||||
PhabricatorCustomFieldInterface,
|
||||
PhabricatorDestructibleInterface,
|
||||
PhabricatorApplicationTransactionInterface {
|
||||
PhabricatorApplicationTransactionInterface,
|
||||
PhabricatorProjectInterface {
|
||||
|
||||
const MARKUP_FIELD_DESCRIPTION = 'markup:desc';
|
||||
|
||||
|
|
|
@ -42,9 +42,54 @@ final class PhabricatorProjectUIEventListener
|
|||
$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'));
|
||||
}
|
||||
|
|
|
@ -1959,18 +1959,10 @@ abstract class PhabricatorApplicationTransactionEditor
|
|||
$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;
|
||||
|
|
Loading…
Reference in a new issue