@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.

Fix expansion of projects into lists of user PHIDs

Summary:
Ref T11016. I think I inverted the meaning of this function by accident in D14893.

The intent is to return a list of users: direct users, and all members of all projects.

Prior to this patch actually returns direct users, and all projects they are members of.

Test Plan:
- Created "Project with Dog".
- Added user "dog" to project.
- Created package "X", owning file "/x", with audit enabled.
- Made "X" owned by "Project with Dog".
- Modified "/x" and had user "dog" accept it.
- Landed change.
- Prior to change: package "X" incorrectly added as auditor.
- After change: package "X" correctly omitted as auditor, because a member reviewed the change.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11016

Differential Revision: https://secure.phabricator.com/D15971

+25 -13
+25 -13
src/applications/owners/storage/PhabricatorOwnersOwner.php
··· 45 45 'packageID IN (%Ls)', 46 46 $package_ids); 47 47 48 - $all_phids = phid_group_by_type(mpull($owners, 'getUserPHID')); 48 + $type_user = PhabricatorPeopleUserPHIDType::TYPECONST; 49 + $type_project = PhabricatorProjectProjectPHIDType::TYPECONST; 49 50 50 - $user_phids = idx($all_phids, 51 - PhabricatorPeopleUserPHIDType::TYPECONST, 52 - array()); 51 + $user_phids = array(); 52 + $project_phids = array(); 53 + foreach ($owners as $owner) { 54 + $owner_phid = $owner->getUserPHID(); 55 + switch (phid_get_type($owner_phid)) { 56 + case PhabricatorPeopleUserPHIDType::TYPECONST: 57 + $user_phids[] = $owner_phid; 58 + break; 59 + case PhabricatorProjectProjectPHIDType::TYPECONST: 60 + $project_phids[] = $owner_phid; 61 + break; 62 + } 63 + } 53 64 54 - if ($user_phids) { 65 + if ($project_phids) { 55 66 $projects = id(new PhabricatorProjectQuery()) 56 67 ->setViewer(PhabricatorUser::getOmnipotentUser()) 57 - ->withMemberPHIDs($user_phids) 58 - ->withIsMilestone(false) 68 + ->withPHIDs($project_phids) 69 + ->needMembers(true) 59 70 ->execute(); 60 - $project_phids = mpull($projects, 'getPHID'); 61 - } else { 62 - $project_phids = array(); 71 + foreach ($projects as $project) { 72 + foreach ($project->getMemberPHIDs() as $member_phid) { 73 + $user_phids[] = $member_phid; 74 + } 75 + } 63 76 } 64 77 65 - $all_phids = array_fuse($user_phids) + array_fuse($project_phids); 66 - 67 - return array_values($all_phids); 78 + $user_phids = array_fuse($user_phids); 79 + return array_values($user_phids); 68 80 } 69 81 }