diff --git a/src/applications/owners/conduit/ConduitAPI_owners_query_Method.php b/src/applications/owners/conduit/ConduitAPI_owners_query_Method.php index 6dc68f44d7..1d92535c3f 100644 --- a/src/applications/owners/conduit/ConduitAPI_owners_query_Method.php +++ b/src/applications/owners/conduit/ConduitAPI_owners_query_Method.php @@ -74,9 +74,12 @@ final class ConduitAPI_owners_query_Method ->setErrorDescription( 'Repository callsign '.$repo_callsign.' not recognized'); } - - return PhabricatorOwnersPackage::loadOwningPackages( - $repository, $path); + if ($path == null) { + return PhabricatorOwnersPackage::loadPackagesForRepository($repository); + } else { + return PhabricatorOwnersPackage::loadOwningPackages( + $repository, $path); + } } public static function buildPackageInformationDictionaries($packages) { @@ -116,7 +119,7 @@ final class ConduitAPI_owners_query_Method $repo = $request->getValue('repositoryCallsign'); $path = $request->getValue('path'); - $is_path_query = ($repo && $path) ? 1 : 0; + $is_path_query = $repo ? 1 : 0; if ($is_owner_query + $is_path_query + $is_affiliated_query === 0) { // if no search terms are provided, return everything diff --git a/src/applications/owners/storage/PhabricatorOwnersPackage.php b/src/applications/owners/storage/PhabricatorOwnersPackage.php index 25a4f4c611..b2e575f4ec 100644 --- a/src/applications/owners/storage/PhabricatorOwnersPackage.php +++ b/src/applications/owners/storage/PhabricatorOwnersPackage.php @@ -182,6 +182,19 @@ final class PhabricatorOwnersPackage extends PhabricatorOwnersDAO return $packages; } + public static function loadPackagesForRepository($repository) { + $package = new PhabricatorOwnersPackage(); + $ids = ipull( + queryfx_all( + $package->establishConnection('r'), + 'SELECT DISTINCT packageID FROM %T WHERE repositoryPHID = %s', + id(new PhabricatorOwnersPath())->getTableName(), + $repository->getPHID()), + 'packageID'); + + return $package->loadAllWhere('id in (%Ld)', $ids); + } + public static function findLongestPathsPerPackage(array $rows, array $paths) { $ids = array();