mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-02 02:40:58 +01:00
Include more packages in Owned Packages view
Summary: If a user is a member of a project, and that project is an owner of a package, it would make sense to display those packages in the list of owned packages. Test Plan: create a project that I'm a member of, then create a package that that project owns, and reload /owners/view/owned/ and see the package listed. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D5355
This commit is contained in:
parent
abdaf90239
commit
3b7203dc9f
2 changed files with 20 additions and 0 deletions
|
@ -61,6 +61,7 @@ abstract class PhabricatorOwnersController extends PhabricatorController {
|
|||
$nav->addLabel('Packages');
|
||||
$this->getExtraPackageViews($nav);
|
||||
$nav->addFilter('view/owned', 'Owned');
|
||||
$nav->addFilter('view/projects', 'Projects');
|
||||
$nav->addFilter('view/all', 'All');
|
||||
|
||||
$nav->selectFilter($this->getSideNavFilter(), 'view/owned');
|
||||
|
|
|
@ -105,6 +105,25 @@ final class PhabricatorOwnersListController
|
|||
$user->getPHID());
|
||||
$packages = $package->loadAllFromArray($data);
|
||||
|
||||
$header = 'Owned Packages';
|
||||
$nodata = 'No owned packages';
|
||||
break;
|
||||
case 'projects':
|
||||
$projects = id(new PhabricatorProjectQuery())
|
||||
->setViewer($user)
|
||||
->withMemberPHIDs(array($user->getPHID()))
|
||||
->withStatus(PhabricatorProjectQuery::STATUS_ANY)
|
||||
->execute();
|
||||
$owner_phids = mpull($projects, 'getPHID');
|
||||
$data = queryfx_all(
|
||||
$package->establishConnection('r'),
|
||||
'SELECT p.* FROM %T p JOIN %T o ON p.id = o.packageID
|
||||
WHERE o.userPHID IN (%Ls) GROUP BY p.id',
|
||||
$package->getTableName(),
|
||||
$owner->getTableName(),
|
||||
$owner_phids);
|
||||
$packages = $package->loadAllFromArray($data);
|
||||
|
||||
$header = 'Owned Packages';
|
||||
$nodata = 'No owned packages';
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue