1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Fix exception when viewing Owners packages owned by projects you are a member of

Summary: Fixes T3188. See that task for details.

Test Plan: Viewed packages with and without project membership; no more exception.

Reviewers: btrahan, chad

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3188

Differential Revision: https://secure.phabricator.com/D5918
This commit is contained in:
epriestley 2013-05-13 09:59:42 -07:00
parent df6a66f577
commit bc6d785b51

View file

@ -115,13 +115,17 @@ final class PhabricatorOwnersListController
->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);
if ($owner_phids) {
$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);
} else {
$data = array();
}
$packages = $package->loadAllFromArray($data);
$header = 'Owned Packages';