Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/query/PhabricatorProjectQuery.php
Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | protected function willFilterPage(array $projects) { | ||||
} else { | } else { | ||||
$ancestors = array(); | $ancestors = array(); | ||||
} | } | ||||
$projects = $this->linkProjectGraph($projects, $ancestors); | $projects = $this->linkProjectGraph($projects, $ancestors); | ||||
$viewer_phid = $this->getViewer()->getPHID(); | $viewer_phid = $this->getViewer()->getPHID(); | ||||
$member_type = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; | $material_type = PhabricatorProjectMaterializedMemberEdgeType::EDGECONST; | ||||
$watcher_type = PhabricatorObjectHasWatcherEdgeType::EDGECONST; | $watcher_type = PhabricatorObjectHasWatcherEdgeType::EDGECONST; | ||||
$types = array(); | $types = array(); | ||||
$types[] = $member_type; | $types[] = $material_type; | ||||
if ($this->needWatchers) { | if ($this->needWatchers) { | ||||
$types[] = $watcher_type; | $types[] = $watcher_type; | ||||
} | } | ||||
$all_sources = array(); | $all_sources = array(); | ||||
foreach ($projects as $project) { | foreach ($projects as $project) { | ||||
if ($project->isMilestone()) { | if ($project->isMilestone()) { | ||||
$phid = $project->getParentProjectPHID(); | $phid = $project->getParentProjectPHID(); | ||||
Show All 33 Lines | foreach ($projects as $project) { | ||||
$source_phids = array($project->getParentProjectPHID()); | $source_phids = array($project->getParentProjectPHID()); | ||||
} else { | } else { | ||||
$source_phids = array($project_phid); | $source_phids = array($project_phid); | ||||
} | } | ||||
if ($any_edges) { | if ($any_edges) { | ||||
$member_phids = $edge_query->getDestinationPHIDs( | $member_phids = $edge_query->getDestinationPHIDs( | ||||
$source_phids, | $source_phids, | ||||
array($member_type)); | array($material_type)); | ||||
} else { | } else { | ||||
$member_phids = array(); | $member_phids = array(); | ||||
} | } | ||||
if (in_array($viewer_phid, $member_phids)) { | if (in_array($viewer_phid, $member_phids)) { | ||||
$membership_projects[$project_phid] = $project; | $membership_projects[$project_phid] = $project; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | final class PhabricatorProjectQuery | ||||
protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | protected function buildJoinClauseParts(AphrontDatabaseConnection $conn) { | ||||
$joins = parent::buildJoinClauseParts($conn); | $joins = parent::buildJoinClauseParts($conn); | ||||
if ($this->memberPHIDs !== null) { | if ($this->memberPHIDs !== null) { | ||||
$joins[] = qsprintf( | $joins[] = qsprintf( | ||||
$conn, | $conn, | ||||
'JOIN %T e ON e.src = p.phid AND e.type = %d', | 'JOIN %T e ON e.src = p.phid AND e.type = %d', | ||||
PhabricatorEdgeConfig::TABLE_NAME_EDGE, | PhabricatorEdgeConfig::TABLE_NAME_EDGE, | ||||
PhabricatorProjectProjectHasMemberEdgeType::EDGECONST); | PhabricatorProjectMaterializedMemberEdgeType::EDGECONST); | ||||
} | } | ||||
if ($this->slugs !== null) { | if ($this->slugs !== null) { | ||||
$joins[] = qsprintf( | $joins[] = qsprintf( | ||||
$conn, | $conn, | ||||
'JOIN %T slug on slug.projectPHID = p.phid', | 'JOIN %T slug on slug.projectPHID = p.phid', | ||||
id(new PhabricatorProjectSlug())->getTableName()); | id(new PhabricatorProjectSlug())->getTableName()); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 183 Lines • Show Last 20 Lines |