1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

Remove "Effective User" attachment from Repository Identities

Summary:
See <https://discourse.phabricator-community.org/t/phabricatorrepositoryidentity-attacheffectiveuser-must-be-an-instance-of-phabricatoruser-null-given/1820/3>.

It's possible for an Idenitity to be bound to user X, then for that user to be deleted, e.g. with `bin/remove destroy X`. In this case, we'll fail to load/attach the user to the identity.

Currently, we don't actually use this anywhere, so just stop loading it. Once we start using it (if we ever do), we could figure out what an appropriate policy is in this case.

Test Plan: Browsed around Diffusion, grepped for affected "effective user" methods and found no callsites.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D20224
This commit is contained in:
epriestley 2019-02-28 08:25:13 -08:00
parent cc8dda6299
commit c116deef63
2 changed files with 0 additions and 34 deletions

View file

@ -124,29 +124,6 @@ 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 PhabricatorPeopleQuery())
->withPHIDs($user_ids)
->setViewer($this->getViewer())
->execute();
$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';
}

View file

@ -14,17 +14,6 @@ final class PhabricatorRepositoryIdentity
protected $manuallySetUserPHID;
protected $currentEffectiveUserPHID;
private $effectiveUser = self::ATTACHABLE;
public function attachEffectiveUser(PhabricatorUser $user) {
$this->effectiveUser = $user;
return $this;
}
public function getEffectiveUser() {
return $this->assertAttached($this->effectiveUser);
}
protected function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,