@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+53 -60
+1
src/__phutil_library_map__.php
··· 3670 3670 'PhabricatorCustomFieldInterface', 3671 3671 'PhabricatorDestructibleInterface', 3672 3672 'PhabricatorApplicationTransactionInterface', 3673 + 'PhabricatorProjectInterface', 3673 3674 ), 3674 3675 'ManiphestTaskDescriptionPreviewController' => 'ManiphestController', 3675 3676 'ManiphestTaskDetailController' => 'ManiphestController',
-46
src/applications/maniphest/controller/ManiphestTaskDetailController.php
··· 530 530 $source)); 531 531 } 532 532 533 - $project_phids = $task->getProjectPHIDs(); 534 - if ($project_phids) { 535 - require_celerity_resource('maniphest-task-summary-css'); 536 - 537 - $positions = id(new PhabricatorProjectColumnPositionQuery()) 538 - ->setViewer($viewer) 539 - ->withBoardPHIDs($project_phids) 540 - ->withObjectPHIDs(array($task->getPHID())) 541 - ->needColumns(true) 542 - ->execute(); 543 - $positions = mpull($positions, null, 'getBoardPHID'); 544 - 545 - $project_handles = array(); 546 - $project_annotations = array(); 547 - foreach ($project_phids as $project_phid) { 548 - $handle = $this->getHandle($project_phid); 549 - $project_handles[] = $handle; 550 - 551 - $position = idx($positions, $project_phid); 552 - if ($position) { 553 - $column = $position->getColumn(); 554 - 555 - $column_name = pht('(%s)', $column->getDisplayName()); 556 - $column_link = phutil_tag( 557 - 'a', 558 - array( 559 - 'href' => $handle->getURI().'board/', 560 - 'class' => 'maniphest-board-link', 561 - ), 562 - $column_name); 563 - 564 - $project_annotations[$project_phid] = array( 565 - ' ', 566 - $column_link); 567 - } 568 - } 569 - 570 - $project_rows = id(new PHUIHandleTagListView()) 571 - ->setHandles($project_handles) 572 - ->setAnnotations($project_annotations); 573 - } else { 574 - $project_rows = phutil_tag('em', array(), pht('None')); 575 - } 576 - 577 - $view->addProperty(pht('Projects'), $project_rows); 578 - 579 533 $edge_types = array( 580 534 PhabricatorEdgeConfig::TYPE_TASK_DEPENDED_ON_BY_TASK 581 535 => pht('Blocks'),
+2 -1
src/applications/maniphest/storage/ManiphestTask.php
··· 9 9 PhrequentTrackableInterface, 10 10 PhabricatorCustomFieldInterface, 11 11 PhabricatorDestructibleInterface, 12 - PhabricatorApplicationTransactionInterface { 12 + PhabricatorApplicationTransactionInterface, 13 + PhabricatorProjectInterface { 13 14 14 15 const MARKUP_FIELD_DESCRIPTION = 'markup:desc'; 15 16
+46 -1
src/applications/project/events/PhabricatorProjectUIEventListener.php
··· 42 42 $handles = array(); 43 43 } 44 44 45 + // If this object can appear on boards, build the workboard annotations. 46 + // Some day, this might be a generic interface. For now, only tasks can 47 + // appear on boards. 48 + $can_appear_on_boards = ($object instanceof ManiphestTask); 49 + 50 + $annotations = array(); 51 + if ($handles && $can_appear_on_boards) { 52 + 53 + // TDOO: Generalize this UI and move it out of Maniphest. 54 + 55 + require_celerity_resource('maniphest-task-summary-css'); 56 + 57 + $positions = id(new PhabricatorProjectColumnPositionQuery()) 58 + ->setViewer($user) 59 + ->withBoardPHIDs($project_phids) 60 + ->withObjectPHIDs(array($object->getPHID())) 61 + ->needColumns(true) 62 + ->execute(); 63 + $positions = mpull($positions, null, 'getBoardPHID'); 64 + 65 + foreach ($project_phids as $project_phid) { 66 + $handle = $handles[$project_phid]; 67 + 68 + $position = idx($positions, $project_phid); 69 + if ($position) { 70 + $column = $position->getColumn(); 71 + 72 + $column_name = pht('(%s)', $column->getDisplayName()); 73 + $column_link = phutil_tag( 74 + 'a', 75 + array( 76 + 'href' => $handle->getURI().'board/', 77 + 'class' => 'maniphest-board-link', 78 + ), 79 + $column_name); 80 + 81 + $annotations[$project_phid] = array( 82 + ' ', 83 + $column_link); 84 + } 85 + } 86 + 87 + } 88 + 45 89 if ($handles) { 46 90 $list = id(new PHUIHandleTagListView()) 47 - ->setHandles($handles); 91 + ->setHandles($handles) 92 + ->setAnnotations($annotations); 48 93 } else { 49 94 $list = phutil_tag('em', array(), pht('None')); 50 95 }
+4 -12
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
··· 1959 1959 $has_support = true; 1960 1960 } 1961 1961 1962 - // TODO: The Maniphest legacy stuff should get cleaned up here. 1963 - 1964 - if (($object instanceof ManiphestTask) || 1965 - ($object instanceof PhabricatorProjectInterface)) { 1966 - 1967 - if ($object instanceof PhabricatorProjectInterface) { 1968 - $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( 1969 - $object->getPHID(), 1970 - PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); 1971 - } else { 1972 - $project_phids = $object->getProjectPHIDs(); 1973 - } 1962 + if ($object instanceof PhabricatorProjectInterface) { 1963 + $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs( 1964 + $object->getPHID(), 1965 + PhabricatorProjectObjectHasProjectEdgeType::EDGECONST); 1974 1966 1975 1967 if ($project_phids) { 1976 1968 $watcher_type = PhabricatorEdgeConfig::TYPE_OBJECT_HAS_WATCHER;