@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.

Fix handle loads in ManiphestTaskListView

Summary:
Fixes T4095. Fixes T3817.

- The batch editor has some funky handle code which misses projects, share that.
- Remove some hacks for T3817 that should be good now.

Test Plan: Looked at batch editor, saw projects. Looked at task list.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran, martin.schulz

Maniphest Tasks: T3817, T4095

Differential Revision: https://secure.phabricator.com/D7578

+30 -32
+1 -2
src/applications/maniphest/controller/ManiphestBatchEditController.php
··· 55 55 ->setURI('/maniphest/?ids='.$task_ids); 56 56 } 57 57 58 - $handle_phids = mpull($tasks, 'getOwnerPHID'); 59 - $handles = $this->loadViewerHandles($handle_phids); 58 + $handles = ManiphestTaskListView::loadTaskHandles($user, $tasks); 60 59 61 60 $list = new ManiphestTaskListView(); 62 61 $list->setTasks($tasks);
+1 -25
src/applications/maniphest/controller/ManiphestTaskListController.php
··· 40 40 $group_parameter = nonempty($query->getParameter('group'), 'priority'); 41 41 $order_parameter = nonempty($query->getParameter('order'), 'priority'); 42 42 43 - $handles = $this->loadTaskHandles($tasks); 43 + $handles = ManiphestTaskListView::loadTaskHandles($viewer, $tasks); 44 44 $groups = $this->groupTasks( 45 45 $tasks, 46 46 $group_parameter, ··· 112 112 $lists, 113 113 $this->renderBatchEditor($query), 114 114 )); 115 - } 116 - 117 - private function loadTaskHandles(array $tasks) { 118 - assert_instances_of($tasks, 'ManiphestTask'); 119 - 120 - $phids = array(); 121 - foreach ($tasks as $task) { 122 - $assigned_phid = $task->getOwnerPHID(); 123 - if ($assigned_phid) { 124 - $phids[] = $assigned_phid; 125 - } 126 - foreach ($task->getProjectPHIDs() as $project_phid) { 127 - $phids[] = $project_phid; 128 - } 129 - } 130 - 131 - if (!$phids) { 132 - return array(); 133 - } 134 - 135 - return id(new PhabricatorHandleQuery()) 136 - ->setViewer($this->getRequest()->getUser()) 137 - ->withPHIDs($phids) 138 - ->execute(); 139 115 } 140 116 141 117 private function groupTasks(array $tasks, $group, array $handles) {
+28 -5
src/applications/maniphest/view/ManiphestTaskListView.php
··· 53 53 $item->setHref('/T'.$task->getID()); 54 54 55 55 if ($task->getOwnerPHID()) { 56 - $owner = idx($handles, $task->getOwnerPHID()); 57 - // TODO: This should be guaranteed, see T3817. 58 - if ($owner) { 59 - $item->addByline(pht('Assigned: %s', $owner->renderLink())); 60 - } 56 + $owner = $handles[$task->getOwnerPHID()]; 57 + $item->addByline(pht('Assigned: %s', $owner->renderLink())); 61 58 } 62 59 63 60 $status = $task->getStatus(); ··· 107 104 } 108 105 109 106 return $list; 107 + } 108 + 109 + public static function loadTaskHandles( 110 + PhabricatorUser $viewer, 111 + array $tasks) { 112 + assert_instances_of($tasks, 'ManiphestTask'); 113 + 114 + $phids = array(); 115 + foreach ($tasks as $task) { 116 + $assigned_phid = $task->getOwnerPHID(); 117 + if ($assigned_phid) { 118 + $phids[] = $assigned_phid; 119 + } 120 + foreach ($task->getProjectPHIDs() as $project_phid) { 121 + $phids[] = $project_phid; 122 + } 123 + } 124 + 125 + if (!$phids) { 126 + return array(); 127 + } 128 + 129 + return id(new PhabricatorHandleQuery()) 130 + ->setViewer($viewer) 131 + ->withPHIDs($phids) 132 + ->execute(); 110 133 } 111 134 112 135 }