diff --git a/src/applications/project/query/PhabricatorProjectQuery.php b/src/applications/project/query/PhabricatorProjectQuery.php --- a/src/applications/project/query/PhabricatorProjectQuery.php +++ b/src/applications/project/query/PhabricatorProjectQuery.php @@ -260,14 +260,14 @@ $all_graph = $this->getAllReachableAncestors($projects); - if ($this->needAncestorMembers || $this->needWatchers) { - $src_projects = $all_graph; - } else { - $src_projects = $projects; - } + // NOTE: Although we may not need much information about ancestors, we + // always need to test if the viewer is a member, because we will return + // ancestor projects to the policy filter via ExtendedPolicy calls. If + // we skip populating membership data on a parent, the policy framework + // will think the user is not a member of the parent project. $all_sources = array(); - foreach ($src_projects as $project) { + foreach ($all_graph as $project) { // For milestones, we need parent members. if ($project->isMilestone()) { $parent_phid = $project->getParentProjectPHID(); @@ -306,7 +306,7 @@ } $membership_projects = array(); - foreach ($src_projects as $project) { + foreach ($all_graph as $project) { $project_phid = $project->getPHID(); if ($project->isMilestone()) {