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

Warn and prevent 1-up/2-up switch in Differential if the user is editing an inline

Summary:
See PHI180. Currently, if you begin creating or editing an inline and then swap display modes (for example, with "View Unified"), your edit is lost.

Persisting the editor state is complicated and this is very rare, so just prevent the action and warn the user instead.

Also make the warning persist for a little longer since a few of the messages, including this one, take a couple seconds to read now.

Test Plan:
- Edited a comment, tried to swap display modes, got a warning.
- Swapped display modes normally with no comment being edited.

Reviewers: amckinley

Reviewed By: amckinley

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

+28 -8
+7 -7
resources/celerity/map.php
··· 13 13 'core.pkg.js' => '4c79d74f', 14 14 'darkconsole.pkg.js' => '1f9a31bc', 15 15 'differential.pkg.css' => '45951e9e', 16 - 'differential.pkg.js' => 'ae6460e0', 16 + 'differential.pkg.js' => '500a75c5', 17 17 'diffusion.pkg.css' => 'a2d17c7d', 18 18 'diffusion.pkg.js' => '6134c5a1', 19 19 'favicon.ico' => '30672e08', ··· 396 396 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 397 397 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 398 398 'rsrc/js/application/diff/DiffChangeset.js' => '99abf4cd', 399 - 'rsrc/js/application/diff/DiffChangesetList.js' => '8f1cd52c', 399 + 'rsrc/js/application/diff/DiffChangesetList.js' => '3b77efdd', 400 400 'rsrc/js/application/diff/DiffInline.js' => 'e83d28f3', 401 401 'rsrc/js/application/diff/behavior-preview-link.js' => '051c7832', 402 402 'rsrc/js/application/differential/behavior-comment-preview.js' => '51c5ad07', ··· 775 775 'phabricator-darkmessage' => 'c48cccdd', 776 776 'phabricator-dashboard-css' => 'fe5b1869', 777 777 'phabricator-diff-changeset' => '99abf4cd', 778 - 'phabricator-diff-changeset-list' => '8f1cd52c', 778 + 'phabricator-diff-changeset-list' => '3b77efdd', 779 779 'phabricator-diff-inline' => 'e83d28f3', 780 780 'phabricator-drag-and-drop-file-upload' => '58dea2fa', 781 781 'phabricator-draggable-list' => 'bea6e7f4', ··· 1137 1137 'javelin-dom', 1138 1138 'javelin-magical-init', 1139 1139 ), 1140 + '3b77efdd' => array( 1141 + 'javelin-install', 1142 + 'phuix-button-view', 1143 + ), 1140 1144 '3cb0b2fc' => array( 1141 1145 'javelin-behavior', 1142 1146 'javelin-dom', ··· 1609 1613 ), 1610 1614 '8e1baf68' => array( 1611 1615 'phui-button-css', 1612 - ), 1613 - '8f1cd52c' => array( 1614 - 'javelin-install', 1615 - 'phuix-button-view', 1616 1616 ), 1617 1617 '8f29b364' => array( 1618 1618 'javelin-behavior',
+3
src/applications/differential/view/DifferentialChangesetListView.php
··· 301 301 302 302 'Hide or show all inline comments.' => 303 303 pht('Hide or show all inline comments.'), 304 + 305 + 'Finish editing inline comments before changing display modes.' => 306 + pht('Finish editing inline comments before changing display modes.'), 304 307 ), 305 308 )); 306 309
+18 -1
webroot/rsrc/js/application/diff/DiffChangesetList.js
··· 465 465 new JX.Notification() 466 466 .setContent(message) 467 467 .alterClassName('jx-notification-alert', true) 468 - .setDuration(1000) 468 + .setDuration(3000) 469 469 .show(); 470 470 }, 471 471 ··· 691 691 'div', 692 692 'differential-changeset'); 693 693 694 + var changeset_list = this; 694 695 var changeset = this.getChangesetForNode(node); 695 696 696 697 var menu = new JX.PHUIXDropdownMenu(button); ··· 738 739 var up_item = new JX.PHUIXActionView() 739 740 .setHandler(function(e) { 740 741 if (changeset.isLoaded()) { 742 + 743 + // Don't let the user swap display modes if a comment is being 744 + // edited, since they might lose their work. See PHI180. 745 + var inlines = changeset.getInlines(); 746 + for (var ii = 0; ii < inlines.length; ii++) { 747 + if (inlines[ii].isEditing()) { 748 + changeset_list._warnUser( 749 + pht( 750 + 'Finish editing inline comments before changing display ' + 751 + 'modes.')); 752 + e.prevent(); 753 + menu.close(); 754 + return; 755 + } 756 + } 757 + 741 758 var renderer = changeset.getRenderer(); 742 759 if (renderer == '1up') { 743 760 renderer = '2up';