mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 08:52:39 +01:00
Correctly attach users to identities
Summary: This never worked. Test Plan: Ran `bin/repository rebuild-identities` and viewed identity objects with `currentEffectiveUserID`s and no longer got errors about attempting to attach `null` objects instead of `PhabricatorUser` objects. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Differential Revision: https://secure.phabricator.com/D19495
This commit is contained in:
parent
a7c681b549
commit
787c59744b
1 changed files with 21 additions and 0 deletions
|
@ -124,6 +124,27 @@ final class PhabricatorRepositoryIdentityQuery
|
|||
return $where;
|
||||
}
|
||||
|
||||
protected function didFilterPage(array $identities) {
|
||||
$user_ids = array_filter(
|
||||
mpull($identities, 'getCurrentEffectiveUserPHID', 'getID'));
|
||||
if (!$user_ids) {
|
||||
return $identities;
|
||||
}
|
||||
|
||||
$users = id(new PhabricatorUser())->loadAllWhere(
|
||||
'phid IN (%Ls)', $user_ids);
|
||||
$users = mpull($users, null, 'getPHID');
|
||||
|
||||
foreach ($identities as $identity) {
|
||||
if ($identity->hasEffectiveUser()) {
|
||||
$user = idx($users, $identity->getCurrentEffectiveUserPHID());
|
||||
$identity->attachEffectiveUser($user);
|
||||
}
|
||||
}
|
||||
|
||||
return $identities;
|
||||
}
|
||||
|
||||
public function getQueryApplicationClass() {
|
||||
return 'PhabricatorDiffusionApplication';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue