mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-17 18:21:11 +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();
|
$paths = $package->loadPaths();
|
||||||
$owners = $package->loadOwners();
|
$owners = $package->loadOwners();
|
||||||
|
|
||||||
$phids = array();
|
$repository_phids = array();
|
||||||
foreach ($paths as $path) {
|
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) {
|
foreach ($owners as $owner) {
|
||||||
$phids[$owner->getUserPHID()] = true;
|
$phids[$owner->getUserPHID()] = true;
|
||||||
}
|
}
|
||||||
|
@ -86,15 +97,25 @@ final class PhabricatorOwnersDetailController
|
||||||
|
|
||||||
$path_links = array();
|
$path_links = array();
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
$callsign = $handles[$path->getRepositoryPHID()]->getName();
|
$repo = $repositories[$path->getRepositoryPHID()];
|
||||||
$repo = '<strong>'.phutil_escape_html($callsign).'</strong>';
|
$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(
|
$path_link = phutil_render_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'href' => '/diffusion/'.$callsign.'/browse/:'.$path->getPath(),
|
'href' => (string) $href,
|
||||||
),
|
),
|
||||||
phutil_escape_html($path->getPath()));
|
phutil_escape_html($path->getPath()));
|
||||||
$path_links[] = $repo.' '.$path_link;
|
$path_links[] = $repo_name.' '.$path_link;
|
||||||
}
|
}
|
||||||
$path_links = implode('<br />', $path_links);
|
$path_links = implode('<br />', $path_links);
|
||||||
$rows[] = array(
|
$rows[] = array(
|
||||||
|
|
|
@ -9,9 +9,11 @@
|
||||||
phutil_require_module('phabricator', 'aphront/response/404');
|
phutil_require_module('phabricator', 'aphront/response/404');
|
||||||
phutil_require_module('phabricator', 'applications/audit/query/commit');
|
phutil_require_module('phabricator', 'applications/audit/query/commit');
|
||||||
phutil_require_module('phabricator', 'applications/audit/view/commitlist');
|
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/controller/base');
|
||||||
phutil_require_module('phabricator', 'applications/owners/storage/package');
|
phutil_require_module('phabricator', 'applications/owners/storage/package');
|
||||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
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', 'infrastructure/javelin/markup');
|
||||||
phutil_require_module('phabricator', 'view/control/table');
|
phutil_require_module('phabricator', 'view/control/table');
|
||||||
phutil_require_module('phabricator', 'view/layout/panel');
|
phutil_require_module('phabricator', 'view/layout/panel');
|
||||||
|
|
|
@ -221,17 +221,28 @@ final class PhabricatorOwnersListController
|
||||||
foreach ($owners as $owner) {
|
foreach ($owners as $owner) {
|
||||||
$phids[$owner->getUserPHID()] = true;
|
$phids[$owner->getUserPHID()] = true;
|
||||||
}
|
}
|
||||||
foreach ($paths as $path) {
|
|
||||||
$phids[$path->getRepositoryPHID()] = true;
|
|
||||||
}
|
|
||||||
$phids = array_keys($phids);
|
$phids = array_keys($phids);
|
||||||
|
|
||||||
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
|
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
|
||||||
|
|
||||||
|
$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');
|
$owners = mgroup($owners, 'getPackageID');
|
||||||
$paths = mgroup($paths, 'getPackageID');
|
$paths = mgroup($paths, 'getPackageID');
|
||||||
} else {
|
} else {
|
||||||
$handles = array();
|
$handles = array();
|
||||||
|
$repositories = array();
|
||||||
$owners = array();
|
$owners = array();
|
||||||
$paths = array();
|
$paths = array();
|
||||||
}
|
}
|
||||||
|
@ -250,13 +261,22 @@ final class PhabricatorOwnersListController
|
||||||
|
|
||||||
$pkg_paths = idx($paths, $package->getID(), array());
|
$pkg_paths = idx($paths, $package->getID(), array());
|
||||||
foreach ($pkg_paths as $key => $path) {
|
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] =
|
$pkg_paths[$key] =
|
||||||
'<strong>'.phutil_escape_html($repo).'</strong> '.
|
'<strong>'.phutil_escape_html($repo->getName()).'</strong> '.
|
||||||
phutil_render_tag(
|
phutil_render_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'href' => '/diffusion/'.$repo.'/browse/:'.$path->getPath(),
|
'href' => (string) $href,
|
||||||
),
|
),
|
||||||
phutil_escape_html($path->getPath()));
|
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/controller/base');
|
||||||
phutil_require_module('phabricator', 'applications/owners/storage/owner');
|
phutil_require_module('phabricator', 'applications/owners/storage/owner');
|
||||||
phutil_require_module('phabricator', 'applications/owners/storage/package');
|
phutil_require_module('phabricator', 'applications/owners/storage/package');
|
||||||
|
|
Loading…
Reference in a new issue