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

Make "View" from inline comment previews correctly jump to "isEditing" inlines

Summary:
Ref T13513. Currently, clicking "View" from the inline comment preview (below the "add comment" area at the bottom of the page) only works if the inline isn't being edited.

Update this behavior so it works on inlines in either "Viewing" or "Editing" states.

Test Plan:
- Clicked "View" on a normal inline, got jumped/selected.
- Clicked "View" on an editing inline, got jumped/selected.

Maniphest Tasks: T13513

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

+48 -73
+8 -16
resources/celerity/map.php
··· 13 13 'core.pkg.js' => '1e667bcb', 14 14 'dark-console.pkg.js' => '187792c2', 15 15 'differential.pkg.css' => 'd71d4531', 16 - 'differential.pkg.js' => 'cf4f3263', 16 + 'differential.pkg.js' => '30307170', 17 17 'diffusion.pkg.css' => '42c75c37', 18 18 'diffusion.pkg.js' => 'a98c0bf7', 19 19 'maniphest.pkg.css' => '35995d6d', ··· 380 380 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '1e413dc9', 381 381 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8', 382 382 'rsrc/js/application/diff/DiffChangeset.js' => '700bf848', 383 - 'rsrc/js/application/diff/DiffChangesetList.js' => '6992b85c', 383 + 'rsrc/js/application/diff/DiffChangesetList.js' => '6e668c5b', 384 384 'rsrc/js/application/diff/DiffInline.js' => 'db754a7b', 385 385 'rsrc/js/application/diff/DiffPathView.js' => '8207abf9', 386 386 'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b', 387 - 'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17', 388 387 'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd', 389 388 'rsrc/js/application/differential/behavior-populate.js' => 'b86ef6c2', 390 389 'rsrc/js/application/diffusion/DiffusionLocateFileSource.js' => '94243d89', ··· 612 611 'javelin-behavior-desktop-notifications-control' => '070679fe', 613 612 'javelin-behavior-detect-timezone' => '78bc5d94', 614 613 'javelin-behavior-device' => '0cf79f45', 615 - 'javelin-behavior-diff-preview-link' => 'f51e9c17', 616 614 'javelin-behavior-differential-diff-radios' => '925fe8cd', 617 615 'javelin-behavior-differential-populate' => 'b86ef6c2', 618 616 'javelin-behavior-diffusion-commit-branches' => '4b671572', ··· 777 775 'phabricator-darkmessage' => '26cd4b73', 778 776 'phabricator-dashboard-css' => '5a205b9d', 779 777 'phabricator-diff-changeset' => '700bf848', 780 - 'phabricator-diff-changeset-list' => '6992b85c', 778 + 'phabricator-diff-changeset-list' => '6e668c5b', 781 779 'phabricator-diff-inline' => 'db754a7b', 782 780 'phabricator-diff-path-view' => '8207abf9', 783 781 'phabricator-diff-tree-view' => '5d83623b', ··· 1511 1509 'javelin-install', 1512 1510 'javelin-dom', 1513 1511 ), 1514 - '6992b85c' => array( 1515 - 'javelin-install', 1516 - 'phuix-button-view', 1517 - 'phabricator-diff-tree-view', 1518 - ), 1519 1512 '6a1583a8' => array( 1520 1513 'javelin-behavior', 1521 1514 'javelin-history', ··· 1551 1544 'javelin-reactornode', 1552 1545 'javelin-install', 1553 1546 'javelin-util', 1547 + ), 1548 + '6e668c5b' => array( 1549 + 'javelin-install', 1550 + 'phuix-button-view', 1551 + 'phabricator-diff-tree-view', 1554 1552 ), 1555 1553 '700bf848' => array( 1556 1554 'javelin-dom', ··· 2174 2172 'javelin-dom', 2175 2173 'javelin-vector', 2176 2174 ), 2177 - 'f51e9c17' => array( 2178 - 'javelin-behavior', 2179 - 'javelin-stratcom', 2180 - 'javelin-dom', 2181 - ), 2182 2175 'f84bcbf4' => array( 2183 2176 'javelin-behavior', 2184 2177 'javelin-stratcom', ··· 2429 2422 'phuix-formation-view', 2430 2423 'phuix-formation-column-view', 2431 2424 'phuix-formation-flank-view', 2432 - 'javelin-behavior-diff-preview-link', 2433 2425 ), 2434 2426 'diffusion.pkg.css' => array( 2435 2427 'diffusion-icons-css',
-1
resources/celerity/packages.php
··· 220 220 'phuix-formation-view', 221 221 'phuix-formation-column-view', 222 222 'phuix-formation-flank-view', 223 - 'javelin-behavior-diff-preview-link', 224 223 ), 225 224 'diffusion.pkg.css' => array( 226 225 'diffusion-icons-css',
+3 -3
src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
··· 212 212 'a', 213 213 array( 214 214 'class' => 'inline-button-divider pml msl', 215 - 'meta' => array( 216 - 'anchor' => $anchor_name, 215 + 'meta' => array( 216 + 'inlineCommentID' => $inline->getID(), 217 217 ), 218 - 'sigil' => 'differential-inline-preview-jump', 218 + 'sigil' => 'differential-inline-preview-jump', 219 219 ), 220 220 pht('View')); 221 221
-8
src/infrastructure/diff/view/PHUIDiffInlineCommentPreviewListView.php
··· 28 28 public function render() { 29 29 $viewer = $this->getViewer(); 30 30 31 - $config = array( 32 - 'pht' => array( 33 - 'view' => pht('View'), 34 - ), 35 - ); 36 - 37 - Javelin::initBehavior('diff-preview-link', $config); 38 - 39 31 $inlines = $this->getInlineComments(); 40 32 foreach ($inlines as $key => $inline) { 41 33 $inlines[$key] = $inline->newInlineCommentObject();
+37 -9
webroot/rsrc/js/application/diff/DiffChangesetList.js
··· 1115 1115 this.selectInline(inline); 1116 1116 }, 1117 1117 1118 - selectInline: function(inline) { 1118 + selectInline: function(inline, force, scroll) { 1119 1119 var selection = this._getSelectionState(); 1120 1120 var item; 1121 1121 1122 - // If the comment the user clicked is currently selected, deselect it. 1123 - // This makes it easy to undo things if you clicked by mistake. 1124 - if (selection.cursor !== null) { 1125 - item = selection.items[selection.cursor]; 1126 - if (item.target === inline) { 1127 - this._setSelectionState(null, false); 1128 - return; 1122 + if (!force) { 1123 + // If the comment the user clicked is currently selected, deselect it. 1124 + // This makes it easy to undo things if you clicked by mistake. 1125 + if (selection.cursor !== null) { 1126 + item = selection.items[selection.cursor]; 1127 + if (item.target === inline) { 1128 + this._setSelectionState(null, false); 1129 + return; 1130 + } 1129 1131 } 1130 1132 } 1131 1133 ··· 1136 1138 for (var ii = 0; ii < items.length; ii++) { 1137 1139 item = items[ii]; 1138 1140 if (item.target === inline) { 1139 - this._setSelectionState(item, false); 1141 + this._setSelectionState(item, scroll); 1140 1142 } 1141 1143 } 1144 + 1142 1145 }, 1143 1146 1144 1147 redrawPreview: function() { ··· 2117 2120 ['differential-inline-comment', 'tag:textarea'], 2118 2121 ondraft); 2119 2122 2123 + var on_preview_view = JX.bind(this, this._onPreviewEvent, 'view'); 2124 + JX.Stratcom.listen( 2125 + 'click', 2126 + 'differential-inline-preview-jump', 2127 + on_preview_view); 2128 + }, 2129 + 2130 + _onPreviewEvent: function(action, e) { 2131 + if (this.isAsleep()) { 2132 + return; 2133 + } 2134 + 2135 + var data = e.getNodeData('differential-inline-preview-jump'); 2136 + var inline = this.getInlineByID(data.inlineCommentID); 2137 + if (!inline) { 2138 + return; 2139 + } 2140 + 2141 + e.kill(); 2142 + 2143 + switch (action) { 2144 + case 'view': 2145 + this.selectInline(inline, true, true); 2146 + break; 2147 + } 2120 2148 }, 2121 2149 2122 2150 _onInlineEvent: function(action, e) {
-36
webroot/rsrc/js/application/diff/behavior-preview-link.js
··· 1 - /** 2 - * @provides javelin-behavior-diff-preview-link 3 - * @requires javelin-behavior 4 - * javelin-stratcom 5 - * javelin-dom 6 - */ 7 - 8 - JX.behavior('diff-preview-link', function(config, statics) { 9 - if (statics.initialized) { 10 - return; 11 - } 12 - statics.initialized = true; 13 - 14 - var pht = JX.phtize(config.pht); 15 - 16 - // After inline comment previews are rendered, hook up the links to the 17 - // comments that are visible on the current page. 18 - function link_inline_preview(e) { 19 - var root = e.getData().rootNode; 20 - var links = JX.DOM.scry(root, 'a', 'differential-inline-preview-jump'); 21 - 22 - for (var ii = 0; ii < links.length; ii++) { 23 - var data = JX.Stratcom.getData(links[ii]); 24 - try { 25 - JX.$(data.anchor); 26 - links[ii].href = '#' + data.anchor; 27 - JX.DOM.setContent(links[ii], pht('view')); 28 - } catch (ignored) { 29 - // This inline comment isn't visible, e.g. on some other diff. 30 - } 31 - } 32 - 33 - } 34 - 35 - JX.Stratcom.listen('EditEngine.didCommentPreview', null, link_inline_preview); 36 - });