@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+61 -17
+27 -6
src/applications/owners/controller/detail/PhabricatorOwnersDetailController.php
··· 39 39 $paths = $package->loadPaths(); 40 40 $owners = $package->loadOwners(); 41 41 42 - $phids = array(); 42 + $repository_phids = array(); 43 43 foreach ($paths as $path) { 44 - $phids[$path->getRepositoryPHID()] = true; 44 + $repository_phids[$path->getRepositoryPHID()] = true; 45 + } 46 + 47 + if ($repository_phids) { 48 + $repositories = id(new PhabricatorRepository())->loadAllWhere( 49 + 'phid in (%Ls)', 50 + array_keys($repository_phids)); 51 + $repositories = mpull($repositories, null, 'getPHID'); 52 + } else { 53 + $repositories = array(); 45 54 } 55 + 56 + $phids = array(); 46 57 foreach ($owners as $owner) { 47 58 $phids[$owner->getUserPHID()] = true; 48 59 } ··· 86 97 87 98 $path_links = array(); 88 99 foreach ($paths as $path) { 89 - $callsign = $handles[$path->getRepositoryPHID()]->getName(); 90 - $repo = '<strong>'.phutil_escape_html($callsign).'</strong>'; 100 + $repo = $repositories[$path->getRepositoryPHID()]; 101 + $drequest = DiffusionRequest::newFromDictionary( 102 + array( 103 + 'repository' => $repo, 104 + 'path' => $path->getPath(), 105 + )); 106 + $href = $drequest->generateURI( 107 + array( 108 + 'action' => 'browse' 109 + )); 110 + $repo_name = '<strong>'.phutil_escape_html($repo->getName()). 111 + '</strong>'; 91 112 $path_link = phutil_render_tag( 92 113 'a', 93 114 array( 94 - 'href' => '/diffusion/'.$callsign.'/browse/:'.$path->getPath(), 115 + 'href' => (string) $href, 95 116 ), 96 117 phutil_escape_html($path->getPath())); 97 - $path_links[] = $repo.' '.$path_link; 118 + $path_links[] = $repo_name.' '.$path_link; 98 119 } 99 120 $path_links = implode('<br />', $path_links); 100 121 $rows[] = array(
+2
src/applications/owners/controller/detail/__init__.php
··· 9 9 phutil_require_module('phabricator', 'aphront/response/404'); 10 10 phutil_require_module('phabricator', 'applications/audit/query/commit'); 11 11 phutil_require_module('phabricator', 'applications/audit/view/commitlist'); 12 + phutil_require_module('phabricator', 'applications/diffusion/request/base'); 12 13 phutil_require_module('phabricator', 'applications/owners/controller/base'); 13 14 phutil_require_module('phabricator', 'applications/owners/storage/package'); 14 15 phutil_require_module('phabricator', 'applications/phid/handle/data'); 16 + phutil_require_module('phabricator', 'applications/repository/storage/repository'); 15 17 phutil_require_module('phabricator', 'infrastructure/javelin/markup'); 16 18 phutil_require_module('phabricator', 'view/control/table'); 17 19 phutil_require_module('phabricator', 'view/layout/panel');
+31 -11
src/applications/owners/controller/list/PhabricatorOwnersListController.php
··· 221 221 foreach ($owners as $owner) { 222 222 $phids[$owner->getUserPHID()] = true; 223 223 } 224 + $phids = array_keys($phids); 225 + $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); 226 + 227 + $repository_phids = array(); 224 228 foreach ($paths as $path) { 225 - $phids[$path->getRepositoryPHID()] = true; 229 + $repository_phids[$path->getRepositoryPHID()] = true; 226 230 } 227 - $phids = array_keys($phids); 228 231 229 - $handles = id(new PhabricatorObjectHandleData($phids))->loadHandles(); 232 + if ($repository_phids) { 233 + $repositories = id(new PhabricatorRepository())->loadAllWhere( 234 + 'phid in (%Ls)', 235 + array_keys($repository_phids)); 236 + } else { 237 + $repositories = array(); 238 + } 230 239 231 - $owners = mgroup($owners, 'getPackageID'); 232 - $paths = mgroup($paths, 'getPackageID'); 240 + $repositories = mpull($repositories, null, 'getPHID'); 241 + $owners = mgroup($owners, 'getPackageID'); 242 + $paths = mgroup($paths, 'getPackageID'); 233 243 } else { 234 - $handles = array(); 235 - $owners = array(); 236 - $paths = array(); 244 + $handles = array(); 245 + $repositories = array(); 246 + $owners = array(); 247 + $paths = array(); 237 248 } 238 249 239 250 $rows = array(); ··· 250 261 251 262 $pkg_paths = idx($paths, $package->getID(), array()); 252 263 foreach ($pkg_paths as $key => $path) { 253 - $repo = $handles[$path->getRepositoryPHID()]->getName(); 264 + $repo = $repositories[$path->getRepositoryPHID()]; 265 + $drequest = DiffusionRequest::newFromDictionary( 266 + array( 267 + 'repository' => $repo, 268 + 'path' => $path->getPath(), 269 + )); 270 + $href = $drequest->generateURI( 271 + array( 272 + 'action' => 'browse', 273 + )); 254 274 $pkg_paths[$key] = 255 - '<strong>'.phutil_escape_html($repo).'</strong> '. 275 + '<strong>'.phutil_escape_html($repo->getName()).'</strong> '. 256 276 phutil_render_tag( 257 277 'a', 258 278 array( 259 - 'href' => '/diffusion/'.$repo.'/browse/:'.$path->getPath(), 279 + 'href' => (string) $href, 260 280 ), 261 281 phutil_escape_html($path->getPath())); 262 282 }
+1
src/applications/owners/controller/list/__init__.php
··· 6 6 7 7 8 8 9 + phutil_require_module('phabricator', 'applications/diffusion/request/base'); 9 10 phutil_require_module('phabricator', 'applications/owners/controller/base'); 10 11 phutil_require_module('phabricator', 'applications/owners/storage/owner'); 11 12 phutil_require_module('phabricator', 'applications/owners/storage/package');