Page MenuHomePhabricator

D14892.diff
No OneTemporary

D14892.diff

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
@@ -226,11 +226,21 @@
// If we only need to know if the viewer is a member, we can restrict
// the query to just their PHID.
+ $any_edges = true;
if (!$this->needMembers && !$this->needWatchers) {
- $edge_query->withDestinationPHIDs(array($viewer_phid));
+ if ($viewer_phid) {
+ $edge_query->withDestinationPHIDs(array($viewer_phid));
+ } else {
+ // If we don't need members or watchers and don't have a viewer PHID
+ // (viewer is logged-out or omnipotent), they'll never be a member
+ // so we don't need to issue this query at all.
+ $any_edges = false;
+ }
}
- $edge_query->execute();
+ if ($any_edges) {
+ $edge_query->execute();
+ }
$membership_projects = array();
foreach ($projects as $project) {
@@ -242,9 +252,13 @@
$source_phids = array($project_phid);
}
- $member_phids = $edge_query->getDestinationPHIDs(
- $source_phids,
- array($member_type));
+ if ($any_edges) {
+ $member_phids = $edge_query->getDestinationPHIDs(
+ $source_phids,
+ array($member_type));
+ } else {
+ $member_phids = array();
+ }
if (in_array($viewer_phid, $member_phids)) {
$membership_projects[$project_phid] = $project;

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 16, 2:25 PM (3 d, 19 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7513026
Default Alt Text
D14892.diff (1 KB)

Event Timeline