@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" links on Differential inline comment previews work again

Summary:
Ref T11114. Recent changes broke the links to jump to inline comments from the previews because they get hooked up with JS.

Restore the linking behavior.

Test Plan: Clicked "View" on an inline comment preview, jumped to that comment.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11114

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

+59 -1
+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 + 31 39 $inlines = $this->getInlineComments(); 32 40 foreach ($inlines as $key => $inline) { 33 41 $inlines[$key] = DifferentialInlineComment::newFromModernComment(
+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 + });
+15 -1
webroot/rsrc/js/application/transactions/behavior-comment-actions.js
··· 147 147 if (!response.xactions.length) { 148 148 JX.DOM.hide(panel); 149 149 } else { 150 + var preview_root = JX.$(config.timelineID); 150 151 JX.DOM.setContent( 151 - JX.$(config.timelineID), 152 + preview_root, 152 153 [ 153 154 JX.$H(response.xactions.join('')), 154 155 JX.$H(response.previewContent) 155 156 ]); 156 157 JX.DOM.show(panel); 158 + 159 + // NOTE: Resonses are currently processed before associated behaviors are 160 + // registered. We need to defer invoking this event so that any behaviors 161 + // accompanying the response are registered. 162 + var invoke_preview = function() { 163 + JX.Stratcom.invoke( 164 + 'EditEngine.didCommentPreview', 165 + null, 166 + { 167 + rootNode: preview_root 168 + }); 169 + }; 170 + setTimeout(invoke_preview, 0); 157 171 } 158 172 } 159 173