Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/controller/ManiphestTaskListController.php
| Show All 34 Lines | public function renderResultsList( | ||||
| if (!$tasks) { | if (!$tasks) { | ||||
| return id(new PHUIObjectItemListView()) | return id(new PHUIObjectItemListView()) | ||||
| ->setUser($viewer); | ->setUser($viewer); | ||||
| } | } | ||||
| $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, | ||||
| $handles); | $handles); | ||||
| $can_edit_priority = $this->hasApplicationCapability( | $can_edit_priority = $this->hasApplicationCapability( | ||||
| ManiphestCapabilityEditPriority::CAPABILITY); | ManiphestCapabilityEditPriority::CAPABILITY); | ||||
| ▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | return phutil_tag( | ||||
| 'class' => 'maniphest-list-container', | 'class' => 'maniphest-list-container', | ||||
| ), | ), | ||||
| array( | array( | ||||
| $lists, | $lists, | ||||
| $this->renderBatchEditor($query), | $this->renderBatchEditor($query), | ||||
| )); | )); | ||||
| } | } | ||||
| 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'); | ||||
| $groups = $this->getTaskGrouping($tasks, $group); | $groups = $this->getTaskGrouping($tasks, $group); | ||||
| $results = array(); | $results = array(); | ||||
| foreach ($groups as $label_key => $tasks) { | foreach ($groups as $label_key => $tasks) { | ||||
| ▲ Show 20 Lines • Show All 150 Lines • Show Last 20 Lines | |||||