mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-22 05:20:56 +01:00
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
This commit is contained in:
parent
74e117ae41
commit
d1eed54d85
1 changed files with 28 additions and 16 deletions
|
@ -45,25 +45,37 @@ final class PhabricatorOwnersOwner extends PhabricatorOwnersDAO {
|
|||
'packageID IN (%Ls)',
|
||||
$package_ids);
|
||||
|
||||
$all_phids = phid_group_by_type(mpull($owners, 'getUserPHID'));
|
||||
$type_user = PhabricatorPeopleUserPHIDType::TYPECONST;
|
||||
$type_project = PhabricatorProjectProjectPHIDType::TYPECONST;
|
||||
|
||||
$user_phids = idx($all_phids,
|
||||
PhabricatorPeopleUserPHIDType::TYPECONST,
|
||||
array());
|
||||
$user_phids = array();
|
||||
$project_phids = array();
|
||||
foreach ($owners as $owner) {
|
||||
$owner_phid = $owner->getUserPHID();
|
||||
switch (phid_get_type($owner_phid)) {
|
||||
case PhabricatorPeopleUserPHIDType::TYPECONST:
|
||||
$user_phids[] = $owner_phid;
|
||||
break;
|
||||
case PhabricatorProjectProjectPHIDType::TYPECONST:
|
||||
$project_phids[] = $owner_phid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($user_phids) {
|
||||
if ($project_phids) {
|
||||
$projects = id(new PhabricatorProjectQuery())
|
||||
->setViewer(PhabricatorUser::getOmnipotentUser())
|
||||
->withMemberPHIDs($user_phids)
|
||||
->withIsMilestone(false)
|
||||
->withPHIDs($project_phids)
|
||||
->needMembers(true)
|
||||
->execute();
|
||||
$project_phids = mpull($projects, 'getPHID');
|
||||
} else {
|
||||
$project_phids = array();
|
||||
foreach ($projects as $project) {
|
||||
foreach ($project->getMemberPHIDs() as $member_phid) {
|
||||
$user_phids[] = $member_phid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$all_phids = array_fuse($user_phids) + array_fuse($project_phids);
|
||||
|
||||
return array_values($all_phids);
|
||||
$user_phids = array_fuse($user_phids);
|
||||
return array_values($user_phids);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue