From 253f7b0bb9bdeb54281a2ab4b2655a1ec9bcf0cf Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 20 May 2017 05:39:07 -0700 Subject: [PATCH] (stable) Show a snippet when hovering inlines in the objective list Summary: Ref T12733. Shows a comment snippet when hovering inlines in the objective list. Test Plan: {F4968490} Reviewers: chad Reviewed By: chad Maniphest Tasks: T12733 Differential Revision: https://secure.phabricator.com/D17980 --- resources/celerity/map.php | 12 ++++++------ .../diff/view/PHUIDiffInlineCommentDetailView.php | 9 +++++---- webroot/rsrc/js/application/diff/DiffInline.js | 4 +++- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 402ae9013e..46443e7ecc 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -13,7 +13,7 @@ return array( 'core.pkg.js' => '599698a7', 'darkconsole.pkg.js' => '1f9a31bc', 'differential.pkg.css' => '7d4cfa59', - 'differential.pkg.js' => 'd7e3edd5', + 'differential.pkg.js' => '06cddcc0', 'diffusion.pkg.css' => 'b93d9b8c', 'diffusion.pkg.js' => '84c8f8fd', 'favicon.ico' => '30672e08', @@ -392,7 +392,7 @@ return array( 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 'rsrc/js/application/diff/DiffChangeset.js' => 'cf4e2140', 'rsrc/js/application/diff/DiffChangesetList.js' => 'a716ca27', - 'rsrc/js/application/diff/DiffInline.js' => 'ca0fafde', + 'rsrc/js/application/diff/DiffInline.js' => '4478f8ac', 'rsrc/js/application/diff/ScrollObjective.js' => '9df4e4e2', 'rsrc/js/application/diff/ScrollObjectiveList.js' => '085dd101', 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', @@ -779,7 +779,7 @@ return array( 'phabricator-dashboard-css' => 'fe5b1869', 'phabricator-diff-changeset' => 'cf4e2140', 'phabricator-diff-changeset-list' => 'a716ca27', - 'phabricator-diff-inline' => 'ca0fafde', + 'phabricator-diff-inline' => '4478f8ac', 'phabricator-drag-and-drop-file-upload' => '58dea2fa', 'phabricator-draggable-list' => 'bea6e7f4', 'phabricator-fatal-config-template-css' => '8f18fa41', @@ -1203,6 +1203,9 @@ return array( 'javelin-workflow', 'javelin-workboard-controller', ), + '4478f8ac' => array( + 'javelin-dom', + ), '44959b73' => array( 'javelin-util', 'javelin-uri', @@ -1976,9 +1979,6 @@ return array( 'phabricator-shaped-request', 'conpherence-thread-manager', ), - 'ca0fafde' => array( - 'javelin-dom', - ), 'caade6f2' => array( 'javelin-behavior', 'javelin-request', diff --git a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php index 9fc1e1bded..821834431a 100644 --- a/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php +++ b/src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php @@ -421,6 +421,11 @@ final class PHUIDiffInlineCommentDetailView $actions, )); + $snippet = id(new PhutilUTF8StringTruncator()) + ->setMaximumGlyphs(96) + ->truncateString($inline->getContent()); + $metadata['snippet'] = pht('%s: %s', $author, $snippet); + $markup = javelin_tag( 'div', array( @@ -444,10 +449,6 @@ final class PHUIDiffInlineCommentDetailView phutil_tag_div('phabricator-remarkup', $content)), )); - $snippet = id(new PhutilUTF8StringTruncator()) - ->setMaximumGlyphs(96) - ->truncateString($inline->getContent()); - $summary = phutil_tag( 'div', array( diff --git a/webroot/rsrc/js/application/diff/DiffInline.js b/webroot/rsrc/js/application/diff/DiffInline.js index e7c18ef6ad..1f0d503b9f 100644 --- a/webroot/rsrc/js/application/diff/DiffInline.js +++ b/webroot/rsrc/js/application/diff/DiffInline.js @@ -22,6 +22,7 @@ JX.install('DiffInline', { _undoRow: null, _replyToCommentPHID: null, _originalText: null, + _snippet: null, _isDeleted: false, _isInvisible: false, @@ -75,6 +76,7 @@ JX.install('DiffInline', { this._changesetID = data.changesetID; this._isNew = false; + this._snippet = data.snippet; this.setInvisible(false); @@ -219,7 +221,7 @@ JX.install('DiffInline', { var icon = 'fa-comment'; var color = 'bluegrey'; - var tooltip = null; + var tooltip = this._snippet; var anchor = this._row; if (this._isEditing) {