From eb4256b97debcde7e5e2860923a92ad2d4ec0992 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 15 Feb 2012 13:06:10 -0800 Subject: [PATCH] When a user is a member of no projects, show them no triage tasks, not all triage tasks Summary: The "with projects ... " query boils down to "all triage tasks" when you don't belong to any projects. Just render the "no needs triage in projects you are a member of" element unconditionally in this case. Test Plan: Looked at homepage as a user with no project memberships but some triage-requiring tasks before and after this change. Prior to this change, all triage tasks show; afterwards, none. Reviewers: fratrik, btrahan Reviewed By: fratrik CC: aran, epriestley Differential Revision: https://secure.phabricator.com/D1620 --- .../PhabricatorDirectoryMainController.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/applications/directory/controller/main/PhabricatorDirectoryMainController.php b/src/applications/directory/controller/main/PhabricatorDirectoryMainController.php index e0f8676ea3..8d49b95ecd 100644 --- a/src/applications/directory/controller/main/PhabricatorDirectoryMainController.php +++ b/src/applications/directory/controller/main/PhabricatorDirectoryMainController.php @@ -102,15 +102,19 @@ class PhabricatorDirectoryMainController $user = $this->getRequest()->getUser(); $user_phid = $user->getPHID(); - $task_query = new ManiphestTaskQuery(); - $task_query->withStatus(ManiphestTaskQuery::STATUS_OPEN); - $task_query->withPriority(ManiphestTaskPriority::PRIORITY_TRIAGE); - $task_query->withProjects(mpull($projects, 'getPHID')); - $task_query->withAnyProject(true); - $task_query->setCalculateRows(true); - $task_query->setLimit(10); + if ($projects) { + $task_query = new ManiphestTaskQuery(); + $task_query->withStatus(ManiphestTaskQuery::STATUS_OPEN); + $task_query->withPriority(ManiphestTaskPriority::PRIORITY_TRIAGE); + $task_query->withProjects(mpull($projects, 'getPHID')); + $task_query->withAnyProject(true); + $task_query->setCalculateRows(true); + $task_query->setLimit(10); + $tasks = $task_query->execute(); + } else { + $tasks = array(); + } - $tasks = $task_query->execute(); if ($tasks) { $panel = new AphrontPanelView(); $panel->setHeader('Needs Triage');