@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+29 -17
+11
resources/sql/autopatches/20170526.milestones.php
··· 1 + <?php 2 + 3 + $table = new PhabricatorProject(); 4 + 5 + foreach (new LiskMigrationIterator($table) as $project) { 6 + PhabricatorSearchWorker::queueDocumentForIndexing( 7 + $project->getPHID(), 8 + array( 9 + 'force' => true, 10 + )); 11 + }
+18 -17
src/applications/project/engineextension/PhabricatorProjectsMembershipIndexEngineExtension.php
··· 34 34 } 35 35 36 36 private function materializeProject(PhabricatorProject $project) { 37 - if ($project->isMilestone()) { 38 - return; 39 - } 40 - 41 37 $material_type = PhabricatorProjectMaterializedMemberEdgeType::EDGECONST; 42 38 $member_type = PhabricatorProjectProjectHasMemberEdgeType::EDGECONST; 43 39 44 40 $project_phid = $project->getPHID(); 45 41 46 - $descendants = id(new PhabricatorProjectQuery()) 47 - ->setViewer($this->getViewer()) 48 - ->withAncestorProjectPHIDs(array($project->getPHID())) 49 - ->withIsMilestone(false) 50 - ->withHasSubprojects(false) 51 - ->execute(); 52 - $descendant_phids = mpull($descendants, 'getPHID'); 42 + if ($project->isMilestone()) { 43 + $source_phids = array($project->getParentProjectPHID()); 44 + $has_subprojects = false; 45 + } else { 46 + $descendants = id(new PhabricatorProjectQuery()) 47 + ->setViewer($this->getViewer()) 48 + ->withAncestorProjectPHIDs(array($project->getPHID())) 49 + ->withIsMilestone(false) 50 + ->withHasSubprojects(false) 51 + ->execute(); 52 + $descendant_phids = mpull($descendants, 'getPHID'); 53 53 54 - if ($descendant_phids) { 55 - $source_phids = $descendant_phids; 56 - $has_subprojects = true; 57 - } else { 58 - $source_phids = array($project->getPHID()); 59 - $has_subprojects = false; 54 + if ($descendant_phids) { 55 + $source_phids = $descendant_phids; 56 + $has_subprojects = true; 57 + } else { 58 + $source_phids = array($project->getPHID()); 59 + $has_subprojects = false; 60 + } 60 61 } 61 62 62 63 $conn_w = $project->establishConnection('w');