Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15379267
D7578.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D7578.diff
View Options
Index: src/applications/maniphest/controller/ManiphestBatchEditController.php
===================================================================
--- src/applications/maniphest/controller/ManiphestBatchEditController.php
+++ 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);
Index: src/applications/maniphest/controller/ManiphestTaskListController.php
===================================================================
--- src/applications/maniphest/controller/ManiphestTaskListController.php
+++ 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');
Index: src/applications/maniphest/view/ManiphestTaskListView.php
===================================================================
--- src/applications/maniphest/view/ManiphestTaskListView.php
+++ 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
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 7:54 PM (2 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7668558
Default Alt Text
D7578.diff (3 KB)
Attached To
Mode
D7578: Fix handle loads in ManiphestTaskListView
Attached
Detach File
Event Timeline
Log In to Comment