@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.

Correct minor "jump to symbol" behavior in Differential

Summary:
Ref T13644. Ref T13638.

- Double-encode the symbol that is used as a path component, similar to Diffusion.
- Fix an outdated reference to ".path", which provided context for symbol lookup.
- Prevent command-clicking headers from looking up the path as a symbol.

Test Plan:
- Command-clicked headers, no longer got a symbol.
- Command-clicked stuff with "/", saw it double-encoded and decoded properly.
- Command-clicked normal symbols, saw "path" populate correctly.

Maniphest Tasks: T13644, T13638

Differential Revision: https://secure.phabricator.com/D21641

+46 -26
+9 -9
resources/celerity/map.php
··· 13 13 'core.pkg.js' => 'ab3502fe', 14 14 'dark-console.pkg.js' => '187792c2', 15 15 'differential.pkg.css' => 'ffb69e3d', 16 - 'differential.pkg.js' => '5080baf4', 16 + 'differential.pkg.js' => '5986f349', 17 17 'diffusion.pkg.css' => '42c75c37', 18 18 'diffusion.pkg.js' => '78c9885d', 19 19 'maniphest.pkg.css' => '35995d6d', ··· 437 437 'rsrc/js/application/releeph/releeph-preview-branch.js' => '75184d68', 438 438 'rsrc/js/application/releeph/releeph-request-state-change.js' => '9f081f05', 439 439 'rsrc/js/application/releeph/releeph-request-typeahead.js' => 'aa3a100c', 440 - 'rsrc/js/application/repository/repository-crossreference.js' => '6337cf26', 440 + 'rsrc/js/application/repository/repository-crossreference.js' => '44d48cd1', 441 441 'rsrc/js/application/search/behavior-reorder-profile-menu-items.js' => 'e5bdb730', 442 442 'rsrc/js/application/search/behavior-reorder-queries.js' => 'b86f297f', 443 443 'rsrc/js/application/transactions/behavior-comment-actions.js' => '4dffaeb2', ··· 693 693 'javelin-behavior-reorder-applications' => 'aa371860', 694 694 'javelin-behavior-reorder-columns' => '8ac32fd9', 695 695 'javelin-behavior-reorder-profile-menu-items' => 'e5bdb730', 696 - 'javelin-behavior-repository-crossreference' => '6337cf26', 696 + 'javelin-behavior-repository-crossreference' => '44d48cd1', 697 697 'javelin-behavior-scrollbar' => '92388bae', 698 698 'javelin-behavior-search-reorder-queries' => 'b86f297f', 699 699 'javelin-behavior-select-content' => 'e8240b50', ··· 1309 1309 '43bc9360' => array( 1310 1310 'javelin-install', 1311 1311 ), 1312 + '44d48cd1' => array( 1313 + 'javelin-behavior', 1314 + 'javelin-dom', 1315 + 'javelin-stratcom', 1316 + 'javelin-uri', 1317 + ), 1312 1318 '457f4d16' => array( 1313 1319 'javelin-behavior', 1314 1320 'javelin-stratcom', ··· 1534 1540 'javelin-dom', 1535 1541 'javelin-vector', 1536 1542 'javelin-request', 1537 - 'javelin-uri', 1538 - ), 1539 - '6337cf26' => array( 1540 - 'javelin-behavior', 1541 - 'javelin-dom', 1542 - 'javelin-stratcom', 1543 1543 'javelin-uri', 1544 1544 ), 1545 1545 '65bb0011' => array(
+1
src/applications/differential/view/DifferentialChangesetDetailView.php
··· 246 246 'displayPath' => hsprintf('%s', $display_parts), 247 247 'icon' => $display_icon, 248 248 'pathParts' => $path_parts, 249 + 'symbolPath' => $display_filename, 249 250 250 251 'pathIconIcon' => $changeset->getPathIconIcon(), 251 252 'pathIconColor' => $changeset->getPathIconColor(),
+3
src/applications/diffusion/controller/DiffusionSymbolController.php
··· 4 4 5 5 public function handleRequest(AphrontRequest $request) { 6 6 $viewer = $this->getViewer(); 7 + 8 + // See T13638 for discussion of escaping. 7 9 $name = $request->getURIData('name'); 10 + $name = phutil_unescape_uri_path_component($name); 8 11 9 12 $query = id(new DiffusionSymbolQuery()) 10 13 ->setViewer($viewer)
+2 -2
src/applications/diffusion/engineextension/DiffusionDatasourceEngineExtension.php
··· 66 66 $parts = null; 67 67 if (preg_match('/(.*)(?:\\.|::|->)(.*)/', $symbol, $parts)) { 68 68 return urisprintf( 69 - '/diffusion/symbol/%s/?jump=true&context=%s', 69 + '/diffusion/symbol/%p/?jump=true&context=%s', 70 70 $parts[2], 71 71 $parts[1]); 72 72 } else { 73 73 return urisprintf( 74 - '/diffusion/symbol/%s/?jump=true', 74 + '/diffusion/symbol/%p/?jump=true', 75 75 $symbol); 76 76 } 77 77 }
+31 -15
webroot/rsrc/js/application/repository/repository-crossreference.js
··· 66 66 67 67 var target = e.getTarget(); 68 68 69 - try { 70 - // If we're in an inline comment, don't link symbols. 71 - if (JX.DOM.findAbove(target, 'div', 'differential-inline-comment')) { 72 - return; 73 - } 74 - } catch (ex) { 75 - // Continue if we're not inside an inline comment. 69 + if (!canLinkNode(target)) { 70 + return; 76 71 } 77 72 78 73 // If only part of the symbol was edited, the symbol name itself will ··· 97 92 } 98 93 }); 99 94 } 95 + 96 + function canLinkNode(node) { 97 + try { 98 + // If we're in an inline comment, don't link symbols. 99 + if (JX.DOM.findAbove(node, 'div', 'differential-inline-comment')) { 100 + return false; 101 + } 102 + } catch (ex) { 103 + // Continue if we're not inside an inline comment. 104 + } 105 + 106 + // See T13644. Don't open symbols if we're inside a changeset header. 107 + try { 108 + if (JX.DOM.findAbove(node, 'h1')) { 109 + return false; 110 + } 111 + } catch (ex) { 112 + // Continue if not inside a header. 113 + } 114 + 115 + return true; 116 + } 117 + 100 118 function unhighlight() { 101 119 highlighted && JX.DOM.alterClass(highlighted, classHighlight, false); 102 120 highlighted = null; ··· 159 177 uri_symbol = uri_symbol.trim(); 160 178 161 179 // See T13437. Symbols like "#define" need to be encoded. 180 + // See T13644. Symbols like "a/b" must be double-encoded to survive 181 + // one layer of decoding by the webserver. 182 + uri_symbol = encodeURIComponent(uri_symbol); 162 183 uri_symbol = encodeURIComponent(uri_symbol); 163 184 164 185 var uri = JX.$U('/diffusion/symbol/' + uri_symbol + '/'); ··· 223 244 var changeset; 224 245 try { 225 246 changeset = JX.DOM.findAbove(target, 'div', 'differential-changeset'); 226 - return JX.Stratcom.getData(changeset).path; 247 + return JX.Stratcom.getData(changeset).symbolPath || null; 227 248 } catch (ex) { 228 249 // Ignore. 229 250 } ··· 315 336 316 337 var target = e.getTarget(); 317 338 318 - try { 319 - // If we're in an inline comment, don't link symbols. 320 - if (JX.DOM.findAbove(target, 'div', 'differential-inline-comment')) { 321 - return; 322 - } 323 - } catch (ex) { 324 - // Continue if we're not inside an inline comment. 339 + if (!canLinkNode(target)) { 340 + return; 325 341 } 326 342 327 343 // If only part of the symbol was edited, the symbol name itself will