@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 PhabricatorOwnersOwner::loadAffiliatedPackages()

Summary: See D3193 for discussion.

Test Plan: Ran `owners.query` via conduit, verified I got sensible output.

Reviewers: vrana, btrahan, meitros

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

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

+5 -36
+5 -22
src/applications/conduit/method/owners/ConduitAPI_owners_query_Method.php
··· 81 81 return $packages; 82 82 } 83 83 84 - protected static function queryByAffiliatedUser($owner) { 85 - $is_valid_phid = 86 - phid_get_type($owner) == PhabricatorPHIDConstants::PHID_TYPE_USER; 87 - 88 - if (!$is_valid_phid) { 89 - throw id(new ConduitException('ERR-INVALID-PARAMETER')) 90 - ->setErrorDescription( 91 - 'Expected user PHID for affiliation, got '.$owner); 92 - } 93 - 94 - $owners = PhabricatorOwnersOwner::loadAffiliatedPackages($owner); 95 - 96 - $package_ids = mpull($owners, 'getPackageID'); 97 - $packages = array(); 98 - foreach ($package_ids as $id) { 99 - $packages[] = id(new PhabricatorOwnersPackage())->load($id); 100 - } 101 - return $packages; 102 - } 103 - 104 84 public static function queryByPath($repo_callsign, $path) { 105 85 // note: we call this from the deprecated path.getowners conduit call. 106 86 ··· 165 145 } 166 146 167 147 if ($is_affiliated_query) { 168 - $packages = self::queryByAffiliatedUser( 169 - $request->getValue('userAffiliated')); 148 + $query = id(new PhabricatorOwnersPackageQuery()) 149 + ->setViewer($request->getUser()); 150 + 151 + $query->withOwnerPHIDs(array($request->getValue('userAffiliated'))); 170 152 153 + $packages = $query->execute(); 171 154 } else if ($is_owner_query) { 172 155 $owner = nonempty( 173 156 $request->getValue('userOwner'),
-14
src/applications/owners/storage/PhabricatorOwnersOwner.php
··· 69 69 70 70 return array_unique(array_merge($users_in_project_phids, $user_phids)); 71 71 } 72 - 73 - // Loads all affiliated packages for a user. This includes packages owned by 74 - // any project the user is a member of. 75 - public static function loadAffiliatedPackages($user_phid) { 76 - $query = new PhabricatorProjectQuery(); 77 - $query->withMemberPHIDs(array($user_phid)); 78 - $query->withStatus(PhabricatorProjectQuery::STATUS_ACTIVE); 79 - $projects = $query->execute(); 80 - 81 - $phids = mpull($projects, 'getPHID') + array($user_phid); 82 - return id(new PhabricatorOwnersOwner())->loadAllWhere( 83 - 'userPHID in (%Ls)', 84 - $phids); 85 - } 86 72 }