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

Remove "^" (Prev) and "V" (Next) actions on Differential inline comments

Summary:
Ref T12616. Fixes T12715. I suspect these are very rarely used. (I think you tried to get rid of them before but I pushed back since we couldn't really offer great alternatives at the time?)

Now that the code is in a better place:

- Click an inline's header (just the colored part) to select it with the keyboard selection cursor.
- Click again to deselect it.
- You can use "n" and "p" to jump to comments, so "click + n" is the same as the old "V" action.
- This also makes it easier to swap between keyboard and mouse workflows, since you can jump into things with the keyboard at any inline.

Also, make "Reply" render more consistently.

Test Plan:
- Did all that stuff, things seemed to work OK.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12715, T12616

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

+90 -102
+6 -14
resources/celerity/map.php
··· 13 13 'core.pkg.js' => '8c5f913d', 14 14 'darkconsole.pkg.js' => '1f9a31bc', 15 15 'differential.pkg.css' => '58712637', 16 - 'differential.pkg.js' => 'e486afd0', 16 + 'differential.pkg.js' => 'bd321b6e', 17 17 'diffusion.pkg.css' => 'b93d9b8c', 18 18 'diffusion.pkg.js' => '84c8f8fd', 19 19 'favicon.ico' => '30672e08', ··· 391 391 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 392 392 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 393 393 'rsrc/js/application/diff/DiffChangeset.js' => '145c34e2', 394 - 'rsrc/js/application/diff/DiffChangesetList.js' => 'd93e34c2', 394 + 'rsrc/js/application/diff/DiffChangesetList.js' => 'f1101e6e', 395 395 'rsrc/js/application/diff/DiffInline.js' => 'bdf6b568', 396 396 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', 397 - 'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d', 398 397 'rsrc/js/application/differential/behavior-comment-preview.js' => 'b064af76', 399 398 'rsrc/js/application/differential/behavior-diff-radios.js' => 'e1ff79b1', 400 399 'rsrc/js/application/differential/behavior-edit-inline-comments.js' => '89d11432', ··· 619 618 'javelin-behavior-detect-timezone' => '4c193c96', 620 619 'javelin-behavior-device' => 'bb1dd507', 621 620 'javelin-behavior-diff-preview-link' => '051c7832', 622 - 'javelin-behavior-differential-comment-jump' => '4fdb476d', 623 621 'javelin-behavior-differential-diff-radios' => 'e1ff79b1', 624 622 'javelin-behavior-differential-edit-inline-comments' => '89d11432', 625 623 'javelin-behavior-differential-feedback-preview' => 'b064af76', ··· 782 780 'phabricator-darkmessage' => 'c48cccdd', 783 781 'phabricator-dashboard-css' => 'fe5b1869', 784 782 'phabricator-diff-changeset' => '145c34e2', 785 - 'phabricator-diff-changeset-list' => 'd93e34c2', 783 + 'phabricator-diff-changeset-list' => 'f1101e6e', 786 784 'phabricator-diff-inline' => 'bdf6b568', 787 785 'phabricator-drag-and-drop-file-upload' => '58dea2fa', 788 786 'phabricator-draggable-list' => 'bea6e7f4', ··· 1291 1289 'javelin-stratcom', 1292 1290 'javelin-dom', 1293 1291 ), 1294 - '4fdb476d' => array( 1295 - 'javelin-behavior', 1296 - 'javelin-stratcom', 1297 - 'javelin-dom', 1298 - ), 1299 1292 '503e17fd' => array( 1300 1293 'javelin-install', 1301 1294 'javelin-typeahead-source', ··· 2079 2072 'javelin-util', 2080 2073 'phabricator-shaped-request', 2081 2074 ), 2082 - 'd93e34c2' => array( 2083 - 'javelin-install', 2084 - ), 2085 2075 'de2e896f' => array( 2086 2076 'javelin-behavior', 2087 2077 'javelin-dom', ··· 2183 2173 'javelin-util', 2184 2174 'javelin-workflow', 2185 2175 'javelin-json', 2176 + ), 2177 + 'f1101e6e' => array( 2178 + 'javelin-install', 2186 2179 ), 2187 2180 'f50152ad' => array( 2188 2181 'phui-timeline-view-css', ··· 2431 2424 'javelin-behavior-differential-edit-inline-comments', 2432 2425 'javelin-behavior-differential-populate', 2433 2426 'javelin-behavior-differential-diff-radios', 2434 - 'javelin-behavior-differential-comment-jump', 2435 2427 'javelin-behavior-aphront-drag-and-drop-textarea', 2436 2428 'javelin-behavior-phabricator-object-selector', 2437 2429 'javelin-behavior-repository-crossreference',
-1
resources/celerity/packages.php
··· 196 196 'javelin-behavior-differential-edit-inline-comments', 197 197 'javelin-behavior-differential-populate', 198 198 'javelin-behavior-differential-diff-radios', 199 - 'javelin-behavior-differential-comment-jump', 200 199 'javelin-behavior-aphront-drag-and-drop-textarea', 201 200 'javelin-behavior-phabricator-object-selector', 202 201 'javelin-behavior-repository-crossreference',
-2
src/applications/differential/view/DifferentialChangesetListView.php
··· 270 270 ), 271 271 )); 272 272 273 - $this->initBehavior('differential-comment-jump', array()); 274 - 275 273 if ($this->inlineURI) { 276 274 Javelin::initBehavior('differential-edit-inline-comments', array( 277 275 'uri' => $this->inlineURI,
+37 -53
src/infrastructure/diff/view/PHUIDiffInlineCommentDetailView.php
··· 190 190 } 191 191 } 192 192 193 - $nextprev = null; 194 - if (!$this->preview) { 195 - $nextprev = new PHUIButtonBarView(); 196 - $nextprev->setBorderless(true); 197 - $nextprev->addClass('inline-button-divider'); 193 + $anchor_name = $this->getAnchorName(); 198 194 195 + $action_buttons = array(); 199 196 200 - $up = id(new PHUIButtonView()) 201 - ->setTag('a') 202 - ->setTooltip(pht('Previous')) 203 - ->setIcon('fa-chevron-up') 204 - ->addSigil('differential-inline-prev') 205 - ->setMustCapture(true); 197 + $can_reply = 198 + (!$this->editable) && 199 + (!$this->preview) && 200 + ($this->allowReply) && 206 201 207 - $down = id(new PHUIButtonView()) 202 + // NOTE: No product reason why you can't reply to synthetic comments, 203 + // but the reply mechanism currently sends the inline comment ID to the 204 + // server, not file/line information, and synthetic comments don't have 205 + // an inline comment ID. 206 + (!$is_synthetic); 207 + 208 + 209 + if ($can_reply) { 210 + $action_buttons[] = id(new PHUIButtonView()) 208 211 ->setTag('a') 209 - ->setTooltip(pht('Next')) 210 - ->setIcon('fa-chevron-down') 211 - ->addSigil('differential-inline-next') 212 + ->setIcon('fa-reply') 213 + ->setTooltip(pht('Reply')) 214 + ->addSigil('differential-inline-reply') 212 215 ->setMustCapture(true); 213 - 214 - if ($this->canHide()) { 215 - $hide = id(new PHUIButtonView()) 216 - ->setTag('a') 217 - ->setTooltip(pht('Hide Comment')) 218 - ->setIcon('fa-times') 219 - ->addSigil('hide-inline') 220 - ->setMustCapture(true); 221 - 222 - $nextprev->addButton($hide); 223 - } 224 - 225 - $nextprev->addButton($up); 226 - $nextprev->addButton($down); 227 - 228 - $action_buttons = array(); 229 - if ($this->allowReply) { 230 - if (!$is_synthetic) { 231 - // NOTE: No product reason why you can't reply to these, but the reply 232 - // mechanism currently sends the inline comment ID to the server, not 233 - // file/line information, and synthetic comments don't have an inline 234 - // comment ID. 235 - 236 - $action_buttons[] = id(new PHUIButtonView()) 237 - ->setTag('a') 238 - ->setIcon('fa-reply') 239 - ->setTooltip(pht('Reply')) 240 - ->addSigil('differential-inline-reply') 241 - ->setMustCapture(true); 242 - } 243 - } 244 216 } 245 - 246 - $anchor_name = $this->getAnchorName(); 247 217 248 218 if ($this->editable && !$this->preview) { 249 219 $action_buttons[] = id(new PHUIButtonView()) ··· 277 247 ->setTooltip(pht('Delete')) 278 248 ->setIcon('fa-trash-o') 279 249 ->addSigil('differential-inline-delete') 250 + ->setMustCapture(true); 251 + } 252 + 253 + if (!$this->preview && $this->canHide()) { 254 + $action_buttons[] = id(new PHUIButtonView()) 255 + ->setTag('a') 256 + ->setTooltip(pht('Hide Comment')) 257 + ->setIcon('fa-times') 258 + ->addSigil('hide-inline') 280 259 ->setMustCapture(true); 281 260 } 282 261 ··· 430 409 $done_button, 431 410 $links, 432 411 $actions, 433 - $nextprev, 434 412 )); 435 413 436 414 $markup = javelin_tag( ··· 441 419 'meta' => $metadata, 442 420 ), 443 421 array( 444 - phutil_tag_div('differential-inline-comment-head grouped', array( 445 - $group_left, 446 - $group_right, 447 - )), 422 + javelin_tag( 423 + 'div', 424 + array( 425 + 'class' => 'differential-inline-comment-head grouped', 426 + 'sigil' => 'differential-inline-header', 427 + ), 428 + array( 429 + $group_left, 430 + $group_right, 431 + )), 448 432 phutil_tag_div( 449 433 'differential-inline-comment-content', 450 434 phutil_tag_div('phabricator-remarkup', $content)),
+47
webroot/rsrc/js/application/diff/DiffChangesetList.js
··· 50 50 51 51 var onresize = JX.bind(this, this._ifawake, this._onresize); 52 52 JX.Stratcom.listen('resize', null, onresize); 53 + 54 + var onselect = JX.bind(this, this._ifawake, this._onselect); 55 + JX.Stratcom.listen( 56 + 'mousedown', 57 + ['differential-inline-comment', 'differential-inline-header'], 58 + onselect); 53 59 }, 54 60 55 61 properties: { ··· 663 669 664 670 _onresize: function() { 665 671 this._redrawFocus(); 672 + }, 673 + 674 + _onselect: function(e) { 675 + // If the user clicked some element inside the header, like an action 676 + // icon, ignore the event. They have to click the header element itself. 677 + if (e.getTarget() !== e.getNode('differential-inline-header')) { 678 + return; 679 + } 680 + 681 + var inline = this._getInlineForEvent(e); 682 + if (!inline) { 683 + return; 684 + } 685 + 686 + // The user definitely clicked an inline, so we're going to handle the 687 + // event. 688 + e.kill(); 689 + 690 + var selection = this._getSelectionState(); 691 + var item; 692 + 693 + // If the comment the user clicked is currently selected, deselect it. 694 + // This makes it easy to undo things if you clicked by mistake. 695 + if (selection.cursor !== null) { 696 + item = selection.items[selection.cursor]; 697 + if (item.target === inline) { 698 + this._setSelectionState(null); 699 + return; 700 + } 701 + } 702 + 703 + // Otherwise, select the item that the user clicked. This makes it 704 + // easier to resume keyboard operations after using the mouse to do 705 + // something else. 706 + var items = selection.items; 707 + for (var ii = 0; ii < items.length; ii++) { 708 + item = items[ii]; 709 + if (item.target === inline) { 710 + this._setSelectionState(item); 711 + } 712 + } 666 713 }, 667 714 668 715 _onaction: function(action, e) {
-32
webroot/rsrc/js/application/differential/behavior-comment-jump.js
··· 1 - /** 2 - * @provides javelin-behavior-differential-comment-jump 3 - * @requires javelin-behavior 4 - * javelin-stratcom 5 - * javelin-dom 6 - */ 7 - 8 - JX.behavior('differential-comment-jump', function() { 9 - function handle_jump(offset) { 10 - return function(e) { 11 - var parent = JX.$('differential-review-stage'); 12 - var clicked = e.getNode('differential-inline-comment'); 13 - var inlines = JX.DOM.scry(parent, 'div', 'differential-inline-comment'); 14 - var jumpto = null; 15 - 16 - for (var ii = 0; ii < inlines.length; ii++) { 17 - if (inlines[ii] == clicked) { 18 - jumpto = inlines[(ii + offset + inlines.length) % inlines.length]; 19 - break; 20 - } 21 - } 22 - JX.Stratcom.invoke('differential-toggle-file-request', null, { 23 - element: jumpto 24 - }); 25 - JX.DOM.scrollTo(jumpto); 26 - e.kill(); 27 - }; 28 - } 29 - 30 - JX.Stratcom.listen('click', 'differential-inline-prev', handle_jump(-1)); 31 - JX.Stratcom.listen('click', 'differential-inline-next', handle_jump(+1)); 32 - });