mirror of
https://we.phorge.it/source/phorge.git
synced 2025-04-07 09:58:33 +02:00
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
This commit is contained in:
parent
fb6e38548b
commit
626b3dab3b
3 changed files with 30 additions and 32 deletions
|
@ -55,8 +55,7 @@ final class ManiphestBatchEditController extends ManiphestController {
|
||||||
->setURI('/maniphest/?ids='.$task_ids);
|
->setURI('/maniphest/?ids='.$task_ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
$handle_phids = mpull($tasks, 'getOwnerPHID');
|
$handles = ManiphestTaskListView::loadTaskHandles($user, $tasks);
|
||||||
$handles = $this->loadViewerHandles($handle_phids);
|
|
||||||
|
|
||||||
$list = new ManiphestTaskListView();
|
$list = new ManiphestTaskListView();
|
||||||
$list->setTasks($tasks);
|
$list->setTasks($tasks);
|
||||||
|
|
|
@ -40,7 +40,7 @@ final class ManiphestTaskListController
|
||||||
$group_parameter = nonempty($query->getParameter('group'), 'priority');
|
$group_parameter = nonempty($query->getParameter('group'), 'priority');
|
||||||
$order_parameter = nonempty($query->getParameter('order'), 'priority');
|
$order_parameter = nonempty($query->getParameter('order'), 'priority');
|
||||||
|
|
||||||
$handles = $this->loadTaskHandles($tasks);
|
$handles = ManiphestTaskListView::loadTaskHandles($viewer, $tasks);
|
||||||
$groups = $this->groupTasks(
|
$groups = $this->groupTasks(
|
||||||
$tasks,
|
$tasks,
|
||||||
$group_parameter,
|
$group_parameter,
|
||||||
|
@ -114,30 +114,6 @@ final class ManiphestTaskListController
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
private function groupTasks(array $tasks, $group, array $handles) {
|
||||||
assert_instances_of($tasks, 'ManiphestTask');
|
assert_instances_of($tasks, 'ManiphestTask');
|
||||||
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
||||||
|
|
|
@ -53,11 +53,8 @@ final class ManiphestTaskListView extends ManiphestView {
|
||||||
$item->setHref('/T'.$task->getID());
|
$item->setHref('/T'.$task->getID());
|
||||||
|
|
||||||
if ($task->getOwnerPHID()) {
|
if ($task->getOwnerPHID()) {
|
||||||
$owner = idx($handles, $task->getOwnerPHID());
|
$owner = $handles[$task->getOwnerPHID()];
|
||||||
// TODO: This should be guaranteed, see T3817.
|
$item->addByline(pht('Assigned: %s', $owner->renderLink()));
|
||||||
if ($owner) {
|
|
||||||
$item->addByline(pht('Assigned: %s', $owner->renderLink()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$status = $task->getStatus();
|
$status = $task->getStatus();
|
||||||
|
@ -109,4 +106,30 @@ final class ManiphestTaskListView extends ManiphestView {
|
||||||
return $list;
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue