Page MenuHomePhabricator

D7578.diff

diff --git a/src/applications/maniphest/controller/ManiphestBatchEditController.php b/src/applications/maniphest/controller/ManiphestBatchEditController.php
--- a/src/applications/maniphest/controller/ManiphestBatchEditController.php
+++ b/src/applications/maniphest/controller/ManiphestBatchEditController.php
@@ -55,8 +55,7 @@
->setURI('/maniphest/?ids='.$task_ids);
}
- $handle_phids = mpull($tasks, 'getOwnerPHID');
- $handles = $this->loadViewerHandles($handle_phids);
+ $handles = ManiphestTaskListView::loadTaskHandles($user, $tasks);
$list = new ManiphestTaskListView();
$list->setTasks($tasks);
diff --git a/src/applications/maniphest/controller/ManiphestTaskListController.php b/src/applications/maniphest/controller/ManiphestTaskListController.php
--- a/src/applications/maniphest/controller/ManiphestTaskListController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskListController.php
@@ -40,7 +40,7 @@
$group_parameter = nonempty($query->getParameter('group'), 'priority');
$order_parameter = nonempty($query->getParameter('order'), 'priority');
- $handles = $this->loadTaskHandles($tasks);
+ $handles = ManiphestTaskListView::loadTaskHandles($viewer, $tasks);
$groups = $this->groupTasks(
$tasks,
$group_parameter,
@@ -114,30 +114,6 @@
));
}
- private function loadTaskHandles(array $tasks) {
- assert_instances_of($tasks, 'ManiphestTask');
-
- $phids = array();
- foreach ($tasks as $task) {
- $assigned_phid = $task->getOwnerPHID();
- if ($assigned_phid) {
- $phids[] = $assigned_phid;
- }
- foreach ($task->getProjectPHIDs() as $project_phid) {
- $phids[] = $project_phid;
- }
- }
-
- if (!$phids) {
- return array();
- }
-
- return id(new PhabricatorHandleQuery())
- ->setViewer($this->getRequest()->getUser())
- ->withPHIDs($phids)
- ->execute();
- }
-
private function groupTasks(array $tasks, $group, array $handles) {
assert_instances_of($tasks, 'ManiphestTask');
assert_instances_of($handles, 'PhabricatorObjectHandle');
diff --git a/src/applications/maniphest/view/ManiphestTaskListView.php b/src/applications/maniphest/view/ManiphestTaskListView.php
--- a/src/applications/maniphest/view/ManiphestTaskListView.php
+++ b/src/applications/maniphest/view/ManiphestTaskListView.php
@@ -53,11 +53,8 @@
$item->setHref('/T'.$task->getID());
if ($task->getOwnerPHID()) {
- $owner = idx($handles, $task->getOwnerPHID());
- // TODO: This should be guaranteed, see T3817.
- if ($owner) {
- $item->addByline(pht('Assigned: %s', $owner->renderLink()));
- }
+ $owner = $handles[$task->getOwnerPHID()];
+ $item->addByline(pht('Assigned: %s', $owner->renderLink()));
}
$status = $task->getStatus();
@@ -109,4 +106,30 @@
return $list;
}
+ public static function loadTaskHandles(
+ PhabricatorUser $viewer,
+ array $tasks) {
+ assert_instances_of($tasks, 'ManiphestTask');
+
+ $phids = array();
+ foreach ($tasks as $task) {
+ $assigned_phid = $task->getOwnerPHID();
+ if ($assigned_phid) {
+ $phids[] = $assigned_phid;
+ }
+ foreach ($task->getProjectPHIDs() as $project_phid) {
+ $phids[] = $project_phid;
+ }
+ }
+
+ if (!$phids) {
+ return array();
+ }
+
+ return id(new PhabricatorHandleQuery())
+ ->setViewer($viewer)
+ ->withPHIDs($phids)
+ ->execute();
+ }
+
}

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/j5/jf/jbxt6bznlz5ydvgn
Default Alt Text
D7578.diff (3 KB)

Event Timeline