mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 14:52:41 +01:00
When computing the "Subscribers" policy, use materialized membership
Summary: Fixes T13104. The "Subscribers" policy implementation still uses older logic to query project membership and misses parent projects and milestones which a user is a member of. Instead of doing an edge query for explicit membership, use a project query to find all projects the viewer belongs to. Test Plan: - Created a parent project A. - Created a subproject B. - As Bailey, created a task with "Visible To: Bailey, Subscribers". - Added parent project A as a task subscriber. Then: - As Alice, verified I could not see the task. - As Alice, joined subproject B. - Before patch: still unable to see the task. - After patch: can see the task. - Removed parent project A as a subscriber, verified I could no longer see the task. Maniphest Tasks: T13104 Differential Revision: https://secure.phabricator.com/D19213
This commit is contained in:
parent
1e93b49b1b
commit
598d0c04e7
1 changed files with 7 additions and 3 deletions
|
@ -47,10 +47,14 @@ final class PhabricatorSubscriptionsSubscribersPolicyRule
|
|||
|
||||
// Load the project PHIDs the user is a member of.
|
||||
if (!isset($this->sourcePHIDs[$viewer_phid])) {
|
||||
$source_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(
|
||||
$viewer_phid,
|
||||
PhabricatorProjectMemberOfProjectEdgeType::EDGECONST);
|
||||
$projects = id(new PhabricatorProjectQuery())
|
||||
->setViewer($viewer)
|
||||
->withMemberPHIDs(array($viewer_phid))
|
||||
->execute();
|
||||
|
||||
$source_phids = mpull($projects, 'getPHID');
|
||||
$source_phids[] = $viewer_phid;
|
||||
|
||||
$this->sourcePHIDs[$viewer_phid] = $source_phids;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue