mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
Fix diffusion browse links in the owner's tool
Summary: ...they were broken... Test Plan: clicked links for both SVN and Git repos and got working results Reviewers: vrana, floatinglomas, 20after4 Reviewed By: floatinglomas CC: aran, epriestley Maniphest Tasks: T1250 Differential Revision: https://secure.phabricator.com/D2505
This commit is contained in:
parent
a9000ea21c
commit
eb6041371b
4 changed files with 62 additions and 18 deletions
|
@ -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 = '<strong>'.phutil_escape_html($callsign).'</strong>';
|
||||
$repo = $repositories[$path->getRepositoryPHID()];
|
||||
$drequest = DiffusionRequest::newFromDictionary(
|
||||
array(
|
||||
'repository' => $repo,
|
||||
'path' => $path->getPath(),
|
||||
));
|
||||
$href = $drequest->generateURI(
|
||||
array(
|
||||
'action' => 'browse'
|
||||
));
|
||||
$repo_name = '<strong>'.phutil_escape_html($repo->getName()).
|
||||
'</strong>';
|
||||
$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('<br />', $path_links);
|
||||
$rows[] = array(
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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] =
|
||||
'<strong>'.phutil_escape_html($repo).'</strong> '.
|
||||
'<strong>'.phutil_escape_html($repo->getName()).'</strong> '.
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/diffusion/'.$repo.'/browse/:'.$path->getPath(),
|
||||
'href' => (string) $href,
|
||||
),
|
||||
phutil_escape_html($path->getPath()));
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue