diff --git a/resources/sql/autopatches/20170526.milestones.php b/resources/sql/autopatches/20170526.milestones.php new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20170526.milestones.php @@ -0,0 +1,11 @@ +getPHID(), + array( + 'force' => true, + )); +} diff --git a/src/applications/project/engineextension/PhabricatorProjectsMembershipIndexEngineExtension.php b/src/applications/project/engineextension/PhabricatorProjectsMembershipIndexEngineExtension.php --- a/src/applications/project/engineextension/PhabricatorProjectsMembershipIndexEngineExtension.php +++ b/src/applications/project/engineextension/PhabricatorProjectsMembershipIndexEngineExtension.php @@ -34,29 +34,30 @@ } private function materializeProject(PhabricatorProject $project) { - if ($project->isMilestone()) { - return; - } - $material_type = PhabricatorProjectMaterializedMemberEdgeType::EDGECONST; $member_type = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; $project_phid = $project->getPHID(); - $descendants = id(new PhabricatorProjectQuery()) - ->setViewer($this->getViewer()) - ->withAncestorProjectPHIDs(array($project->getPHID())) - ->withIsMilestone(false) - ->withHasSubprojects(false) - ->execute(); - $descendant_phids = mpull($descendants, 'getPHID'); - - if ($descendant_phids) { - $source_phids = $descendant_phids; - $has_subprojects = true; - } else { - $source_phids = array($project->getPHID()); + if ($project->isMilestone()) { + $source_phids = array($project->getParentProjectPHID()); $has_subprojects = false; + } else { + $descendants = id(new PhabricatorProjectQuery()) + ->setViewer($this->getViewer()) + ->withAncestorProjectPHIDs(array($project->getPHID())) + ->withIsMilestone(false) + ->withHasSubprojects(false) + ->execute(); + $descendant_phids = mpull($descendants, 'getPHID'); + + if ($descendant_phids) { + $source_phids = $descendant_phids; + $has_subprojects = true; + } else { + $source_phids = array($project->getPHID()); + $has_subprojects = false; + } } $conn_w = $project->establishConnection('w');