diff --git a/src/applications/owners/controller/detail/PhabricatorOwnersDetailController.php b/src/applications/owners/controller/detail/PhabricatorOwnersDetailController.php
index 6555cd9448..368997a14c 100644
--- a/src/applications/owners/controller/detail/PhabricatorOwnersDetailController.php
+++ b/src/applications/owners/controller/detail/PhabricatorOwnersDetailController.php
@@ -39,10 +39,21 @@ final class PhabricatorOwnersDetailController
$paths = $package->loadPaths();
$owners = $package->loadOwners();
- $phids = array();
+ $repository_phids = array();
foreach ($paths as $path) {
- $phids[$path->getRepositoryPHID()] = true;
+ $repository_phids[$path->getRepositoryPHID()] = true;
}
+
+ if ($repository_phids) {
+ $repositories = id(new PhabricatorRepository())->loadAllWhere(
+ 'phid in (%Ls)',
+ array_keys($repository_phids));
+ $repositories = mpull($repositories, null, 'getPHID');
+ } else {
+ $repositories = array();
+ }
+
+ $phids = array();
foreach ($owners as $owner) {
$phids[$owner->getUserPHID()] = true;
}
@@ -86,15 +97,25 @@ final class PhabricatorOwnersDetailController
$path_links = array();
foreach ($paths as $path) {
- $callsign = $handles[$path->getRepositoryPHID()]->getName();
- $repo = ''.phutil_escape_html($callsign).'';
+ $repo = $repositories[$path->getRepositoryPHID()];
+ $drequest = DiffusionRequest::newFromDictionary(
+ array(
+ 'repository' => $repo,
+ 'path' => $path->getPath(),
+ ));
+ $href = $drequest->generateURI(
+ array(
+ 'action' => 'browse'
+ ));
+ $repo_name = ''.phutil_escape_html($repo->getName()).
+ '';
$path_link = phutil_render_tag(
'a',
array(
- 'href' => '/diffusion/'.$callsign.'/browse/:'.$path->getPath(),
+ 'href' => (string) $href,
),
phutil_escape_html($path->getPath()));
- $path_links[] = $repo.' '.$path_link;
+ $path_links[] = $repo_name.' '.$path_link;
}
$path_links = implode('
', $path_links);
$rows[] = array(
diff --git a/src/applications/owners/controller/detail/__init__.php b/src/applications/owners/controller/detail/__init__.php
index 2757a98897..2e919b6a2e 100644
--- a/src/applications/owners/controller/detail/__init__.php
+++ b/src/applications/owners/controller/detail/__init__.php
@@ -9,9 +9,11 @@
phutil_require_module('phabricator', 'aphront/response/404');
phutil_require_module('phabricator', 'applications/audit/query/commit');
phutil_require_module('phabricator', 'applications/audit/view/commitlist');
+phutil_require_module('phabricator', 'applications/diffusion/request/base');
phutil_require_module('phabricator', 'applications/owners/controller/base');
phutil_require_module('phabricator', 'applications/owners/storage/package');
phutil_require_module('phabricator', 'applications/phid/handle/data');
+phutil_require_module('phabricator', 'applications/repository/storage/repository');
phutil_require_module('phabricator', 'infrastructure/javelin/markup');
phutil_require_module('phabricator', 'view/control/table');
phutil_require_module('phabricator', 'view/layout/panel');
diff --git a/src/applications/owners/controller/list/PhabricatorOwnersListController.php b/src/applications/owners/controller/list/PhabricatorOwnersListController.php
index 24b5b04369..fc364c10ed 100644
--- a/src/applications/owners/controller/list/PhabricatorOwnersListController.php
+++ b/src/applications/owners/controller/list/PhabricatorOwnersListController.php
@@ -221,19 +221,30 @@ final class PhabricatorOwnersListController
foreach ($owners as $owner) {
$phids[$owner->getUserPHID()] = true;
}
- foreach ($paths as $path) {
- $phids[$path->getRepositoryPHID()] = true;
- }
$phids = array_keys($phids);
-
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
- $owners = mgroup($owners, 'getPackageID');
- $paths = mgroup($paths, 'getPackageID');
+ $repository_phids = array();
+ foreach ($paths as $path) {
+ $repository_phids[$path->getRepositoryPHID()] = true;
+ }
+
+ if ($repository_phids) {
+ $repositories = id(new PhabricatorRepository())->loadAllWhere(
+ 'phid in (%Ls)',
+ array_keys($repository_phids));
+ } else {
+ $repositories = array();
+ }
+
+ $repositories = mpull($repositories, null, 'getPHID');
+ $owners = mgroup($owners, 'getPackageID');
+ $paths = mgroup($paths, 'getPackageID');
} else {
- $handles = array();
- $owners = array();
- $paths = array();
+ $handles = array();
+ $repositories = array();
+ $owners = array();
+ $paths = array();
}
$rows = array();
@@ -250,13 +261,22 @@ final class PhabricatorOwnersListController
$pkg_paths = idx($paths, $package->getID(), array());
foreach ($pkg_paths as $key => $path) {
- $repo = $handles[$path->getRepositoryPHID()]->getName();
+ $repo = $repositories[$path->getRepositoryPHID()];
+ $drequest = DiffusionRequest::newFromDictionary(
+ array(
+ 'repository' => $repo,
+ 'path' => $path->getPath(),
+ ));
+ $href = $drequest->generateURI(
+ array(
+ 'action' => 'browse',
+ ));
$pkg_paths[$key] =
- ''.phutil_escape_html($repo).' '.
+ ''.phutil_escape_html($repo->getName()).' '.
phutil_render_tag(
'a',
array(
- 'href' => '/diffusion/'.$repo.'/browse/:'.$path->getPath(),
+ 'href' => (string) $href,
),
phutil_escape_html($path->getPath()));
}
diff --git a/src/applications/owners/controller/list/__init__.php b/src/applications/owners/controller/list/__init__.php
index 222c83cd5f..d8bd8ac675 100644
--- a/src/applications/owners/controller/list/__init__.php
+++ b/src/applications/owners/controller/list/__init__.php
@@ -6,6 +6,7 @@
+phutil_require_module('phabricator', 'applications/diffusion/request/base');
phutil_require_module('phabricator', 'applications/owners/controller/base');
phutil_require_module('phabricator', 'applications/owners/storage/owner');
phutil_require_module('phabricator', 'applications/owners/storage/package');