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

Fix `packages(project)` to work properly and add it to "MailableFunctionDatasource"

Summary:
Ref T13210. See PHI937. This function datasource isn't quite implemented correctly: it doesn't resolve `package(project)` properly, since the logic only handles users.

This blames back to D14013, where it looks like `packages(..)` was added mostly as a general nice-to-have as part of a larger modernization change.

Test Plan: Ran a `packages(project)` query in Differential, got accurate results (previously: no results).

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13210

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

+18 -9
+1
src/applications/metamta/typeahead/PhabricatorMetaMTAMailableFunctionDatasource.php
··· 23 23 new PhabricatorProjectMembersDatasource(), 24 24 new PhabricatorProjectDatasource(), 25 25 new PhabricatorOwnersPackageDatasource(), 26 + new PhabricatorOwnersPackageOwnerDatasource(), 26 27 ); 27 28 } 28 29
+17 -9
src/applications/owners/typeahead/PhabricatorOwnersPackageOwnerDatasource.php
··· 27 27 'packages' => array( 28 28 'name' => pht('Packages: ...'), 29 29 'arguments' => pht('owner'), 30 - 'summary' => pht("Find results in any of an owner's projects."), 30 + 'summary' => pht("Find results in any of an owner's packages."), 31 31 'description' => pht( 32 32 "This function allows you to find results associated with any ". 33 33 "of the packages a specified user or project is an owner of. ". ··· 61 61 62 62 $phids = $this->resolvePHIDs($phids); 63 63 64 - $user_phids = array(); 64 + $owner_phids = array(); 65 65 foreach ($phids as $key => $phid) { 66 - if (phid_get_type($phid) == PhabricatorPeopleUserPHIDType::TYPECONST) { 67 - $user_phids[] = $phid; 68 - unset($phids[$key]); 66 + switch (phid_get_type($phid)) { 67 + case PhabricatorPeopleUserPHIDType::TYPECONST: 68 + case PhabricatorProjectProjectPHIDType::TYPECONST: 69 + $owner_phids[] = $phid; 70 + unset($phids[$key]); 71 + break; 69 72 } 70 73 } 71 74 72 - if ($user_phids) { 75 + if ($owner_phids) { 73 76 $packages = id(new PhabricatorOwnersPackageQuery()) 74 77 ->setViewer($this->getViewer()) 75 - ->withOwnerPHIDs($user_phids) 78 + ->withOwnerPHIDs($owner_phids) 76 79 ->execute(); 77 80 foreach ($packages as $package) { 78 81 $phids[] = $package->getPHID(); ··· 116 119 117 120 $usernames = array(); 118 121 foreach ($phids as $key => $phid) { 119 - if (phid_get_type($phid) != PhabricatorPeopleUserPHIDType::TYPECONST) { 120 - $usernames[$key] = $phid; 122 + switch (phid_get_type($phid)) { 123 + case PhabricatorPeopleUserPHIDType::TYPECONST: 124 + case PhabricatorProjectProjectPHIDType::TYPECONST: 125 + break; 126 + default: 127 + $usernames[$key] = $phid; 128 + break; 121 129 } 122 130 } 123 131