mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 00:32:42 +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:
parent
fc8465252f
commit
b27c2ed6d1
2 changed files with 29 additions and 17 deletions
11
resources/sql/autopatches/20170526.milestones.php
Normal file
11
resources/sql/autopatches/20170526.milestones.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
$table = new PhabricatorProject();
|
||||
|
||||
foreach (new LiskMigrationIterator($table) as $project) {
|
||||
PhabricatorSearchWorker::queueDocumentForIndexing(
|
||||
$project->getPHID(),
|
||||
array(
|
||||
'force' => true,
|
||||
));
|
||||
}
|
|
@ -34,29 +34,30 @@ final class PhabricatorProjectsMembershipIndexEngineExtension
|
|||
}
|
||||
|
||||
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');
|
||||
|
|
Loading…
Reference in a new issue