1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Fix an incorrect filtering of groupless results from Maniphest "Group By" query

Summary:
Fixes T5081. This block enforces policies and prevents you from seeing groups associated with projects you can't see. However, it incorrectly removes tasks which end up with no group key. This can happen in two cases:

  - The task isn't in a project.
  - The task is in a project, but the query includes an "In All Projects: <that project>" constraint. In that case, we don't show the group becuase it would always contain every task.

Test Plan:
Replicated the setup in T5081, saw an "Ungrouped" group with "Task A":

{F155766}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5081

Differential Revision: https://secure.phabricator.com/D9152
This commit is contained in:
epriestley 2014-05-16 08:47:06 -07:00
parent 4925dd7e6e
commit 3e9a988cd7
2 changed files with 12 additions and 1 deletions

View file

@ -304,6 +304,12 @@ final class ManiphestTaskQuery
$projects = mpull($projects, null, 'getPHID');
foreach ($tasks as $key => $task) {
if (!$task->getGroupByProjectPHID()) {
// This task is either not in any projects, or only in projects
// which we're ignoring because they're being queried for explicitly.
continue;
}
if (empty($projects[$task->getGroupByProjectPHID()])) {
unset($tasks[$key]);
}

View file

@ -170,7 +170,12 @@ final class ManiphestTaskResultListView extends ManiphestView {
if ($label_key) {
return $handles[$label_key]->getFullName();
} else {
return pht('(No Project)');
// This may mean "No Projects", or it may mean the query has project
// constraints but the task is only in constrained projects (in this
// case, we don't show the group because it would always have all
// of the tasks). Since distinguishing between these two cases is
// messy and the UI is reasonably clear, label generically.
return pht('(Ungrouped)');
}
default:
return pht('Tasks');