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

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

-34
-23
src/applications/repository/query/PhabricatorRepositoryIdentityQuery.php
··· 124 124 return $where; 125 125 } 126 126 127 - protected function didFilterPage(array $identities) { 128 - $user_ids = array_filter( 129 - mpull($identities, 'getCurrentEffectiveUserPHID', 'getID')); 130 - if (!$user_ids) { 131 - return $identities; 132 - } 133 - 134 - $users = id(new PhabricatorPeopleQuery()) 135 - ->withPHIDs($user_ids) 136 - ->setViewer($this->getViewer()) 137 - ->execute(); 138 - $users = mpull($users, null, 'getPHID'); 139 - 140 - foreach ($identities as $identity) { 141 - if ($identity->hasEffectiveUser()) { 142 - $user = idx($users, $identity->getCurrentEffectiveUserPHID()); 143 - $identity->attachEffectiveUser($user); 144 - } 145 - } 146 - 147 - return $identities; 148 - } 149 - 150 127 public function getQueryApplicationClass() { 151 128 return 'PhabricatorDiffusionApplication'; 152 129 }
-11
src/applications/repository/storage/PhabricatorRepositoryIdentity.php
··· 14 14 protected $manuallySetUserPHID; 15 15 protected $currentEffectiveUserPHID; 16 16 17 - private $effectiveUser = self::ATTACHABLE; 18 - 19 - public function attachEffectiveUser(PhabricatorUser $user) { 20 - $this->effectiveUser = $user; 21 - return $this; 22 - } 23 - 24 - public function getEffectiveUser() { 25 - return $this->assertAttached($this->effectiveUser); 26 - } 27 - 28 17 protected function getConfiguration() { 29 18 return array( 30 19 self::CONFIG_AUX_PHID => true,