1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-29 18:22:41 +01:00

Index Project milestones to accurately reflect milestone membership

Summary: Fixes T12505. `PhabricatorProjectsMembershipIndexEngineExtension->materializeProject()` was incorrectly bailing early for milestone objects, which prevented milestone members from being calculated correctly. This was causing problems where (for example) an Owners package owned by a milestone wasn't being satisfied when a member of the milestone approved a revision.

Test Plan: Invoked migration, observed that a user's milestones correctly showed up when searched for. Also observed that accepting a revision on behalf of a milestone now satisfies Owners rules.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin

Maniphest Tasks: T12505

Differential Revision: https://secure.phabricator.com/D18033
This commit is contained in:
Austin McKinley 2017-05-26 13:01:28 -07:00
parent fc8465252f
commit b27c2ed6d1
2 changed files with 29 additions and 17 deletions

View file

@ -0,0 +1,11 @@
<?php
$table = new PhabricatorProject();
foreach (new LiskMigrationIterator($table) as $project) {
PhabricatorSearchWorker::queueDocumentForIndexing(
$project->getPHID(),
array(
'force' => true,
));
}

View file

@ -34,15 +34,15 @@ final class PhabricatorProjectsMembershipIndexEngineExtension
} }
private function materializeProject(PhabricatorProject $project) { private function materializeProject(PhabricatorProject $project) {
if ($project->isMilestone()) {
return;
}
$material_type = PhabricatorProjectMaterializedMemberEdgeType::EDGECONST; $material_type = PhabricatorProjectMaterializedMemberEdgeType::EDGECONST;
$member_type = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; $member_type = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST;
$project_phid = $project->getPHID(); $project_phid = $project->getPHID();
if ($project->isMilestone()) {
$source_phids = array($project->getParentProjectPHID());
$has_subprojects = false;
} else {
$descendants = id(new PhabricatorProjectQuery()) $descendants = id(new PhabricatorProjectQuery())
->setViewer($this->getViewer()) ->setViewer($this->getViewer())
->withAncestorProjectPHIDs(array($project->getPHID())) ->withAncestorProjectPHIDs(array($project->getPHID()))
@ -58,6 +58,7 @@ final class PhabricatorProjectsMembershipIndexEngineExtension
$source_phids = array($project->getPHID()); $source_phids = array($project->getPHID());
$has_subprojects = false; $has_subprojects = false;
} }
}
$conn_w = $project->establishConnection('w'); $conn_w = $project->establishConnection('w');