From 75e89c0c7848efa68e8edcbc47779bb9cefdf5be Mon Sep 17 00:00:00 2001 From: 20after4 <20after4@deviantart.com> Date: Fri, 30 Mar 2012 10:55:18 -0700 Subject: [PATCH] Amended D2009 based on feedback from @epriestley. Test Plan: Try out https://secure.phabricator.com/maniphest/view/projectall/?g=j with tasks assigned to just one project, and also with tasks assigned to more than one project. Reviewers: epriestley Reviewed By: epriestley CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D2012 --- .../tasklist/ManiphestTaskListController.php | 10 ++++++---- .../maniphest/query/ManiphestTaskQuery.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php b/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php index 507ff0377c..2e9f88b012 100644 --- a/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php +++ b/src/applications/maniphest/controller/tasklist/ManiphestTaskListController.php @@ -301,7 +301,7 @@ final class ManiphestTaskListController extends ManiphestController { } public static function loadTasks(PhabricatorSearchQuery $search_query) { - + $any_project = false; $user_phids = $search_query->getParameter('userPHIDs', array()); $project_phids = $search_query->getParameter('projectPHIDs', array()); $task_ids = $search_query->getParameter('taskIDs', array()); @@ -357,13 +357,15 @@ final class ManiphestTaskListController extends ManiphestController { break; case 'projecttriage': $query->withPriority(ManiphestTaskPriority::PRIORITY_TRIAGE); - $query->withAnyProject(true); + $any_project = true; break; case 'projectall': - $query->withAnyProject(true); + $any_project = true; break; } + $query->withAnyProject($any_project); + $order_map = array( 'priority' => ManiphestTaskQuery::ORDER_PRIORITY, 'created' => ManiphestTaskQuery::ORDER_CREATED, @@ -465,7 +467,7 @@ final class ManiphestTaskListController extends ManiphestController { $grouped = array(); foreach ($data as $task) { $phids = $task->getProjectPHIDs(); - if ($project_phids) { + if ($project_phids && $any_project !== true) { // If the user is filtering on "Bugs", don't show a "Bugs" group // with every result since that's silly (the query also does this // on the backend). diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php index c0edae6c0f..4bd7afe03c 100644 --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -504,7 +504,7 @@ final class ManiphestTaskQuery { $ii = 0; foreach ($tasks as $key => $task) { $phids = $task->getProjectPHIDs(); - if ($this->projectPHIDs) { + if (!$this->anyProject && $this->projectPHIDs) { $phids = array_diff($phids, $this->projectPHIDs); } if ($phids) {