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

When a user clicks "Cancel" on an inline comment to leave the "Editing" state, save the state change

Summary:
Ref T13513. Now that the "currently being edited" state of inlines is saved on the server side, clear the flag when the user clicks "Cancel" to leave the "editing" state on the client.

This also serves to delete empty comments.

Test Plan:
- Clicked a line number to create a new comment. Then:
- Clicked "Cancel". Reloaded page, saw no more comment.
- Typed text, saved. Reloaded page, saw non-editing draft. Clicked "Edit", reloaded page, saw editing draft. Clicked "Cancel", reloaded page, saw non-editing draft.
- Typed text, saved. Clicked "Edit", deleted text, saved. Reloaded page, saw no more comment.

Maniphest Tasks: T13513

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

+33 -7
+6 -6
resources/celerity/map.php
··· 13 13 'core.pkg.js' => '632fb8f5', 14 14 'dark-console.pkg.js' => '187792c2', 15 15 'differential.pkg.css' => '2d70b7b9', 16 - 'differential.pkg.js' => 'b289f75d', 16 + 'differential.pkg.js' => 'b35de23a', 17 17 'diffusion.pkg.css' => '42c75c37', 18 18 'diffusion.pkg.js' => 'a98c0bf7', 19 19 'maniphest.pkg.css' => '35995d6d', ··· 381 381 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8', 382 382 'rsrc/js/application/diff/DiffChangeset.js' => '9a713ba5', 383 383 'rsrc/js/application/diff/DiffChangesetList.js' => '10726e6a', 384 - 'rsrc/js/application/diff/DiffInline.js' => '7b0bdd6d', 384 + 'rsrc/js/application/diff/DiffInline.js' => '02791ed9', 385 385 'rsrc/js/application/diff/DiffPathView.js' => '8207abf9', 386 386 'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b', 387 387 'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17', ··· 778 778 'phabricator-dashboard-css' => '5a205b9d', 779 779 'phabricator-diff-changeset' => '9a713ba5', 780 780 'phabricator-diff-changeset-list' => '10726e6a', 781 - 'phabricator-diff-inline' => '7b0bdd6d', 781 + 'phabricator-diff-inline' => '02791ed9', 782 782 'phabricator-diff-path-view' => '8207abf9', 783 783 'phabricator-diff-tree-view' => '5d83623b', 784 784 'phabricator-drag-and-drop-file-upload' => '4370900d', ··· 944 944 'javelin-leader', 945 945 'javelin-json', 946 946 ), 947 + '02791ed9' => array( 948 + 'javelin-dom', 949 + ), 947 950 '02cb4398' => array( 948 951 'javelin-behavior', 949 952 'javelin-dom', ··· 1615 1618 'javelin-dom', 1616 1619 'phabricator-drag-and-drop-file-upload', 1617 1620 'phabricator-textareautils', 1618 - ), 1619 - '7b0bdd6d' => array( 1620 - 'javelin-dom', 1621 1621 ), 1622 1622 '7b139193' => array( 1623 1623 'javelin-behavior',
+13
src/infrastructure/diff/PhabricatorInlineCommentController.php
··· 215 215 $view = $this->buildScaffoldForView($edit_dialog); 216 216 217 217 return $this->newInlineResponse($inline, $view); 218 + case 'cancel': 219 + $inline = $this->loadCommentForEdit($this->getCommentID()); 220 + 221 + $inline->setIsEditing(false); 222 + 223 + $content = $inline->getContent(); 224 + if (!strlen($content)) { 225 + $this->deleteComment($inline); 226 + } else { 227 + $this->saveComment($inline); 228 + } 229 + 230 + return $this->buildEmptyResponse(); 218 231 case 'new': 219 232 case 'reply': 220 233 default:
+14 -1
webroot/rsrc/js/application/diff/DiffInline.js
··· 647 647 } 648 648 649 649 this.setEditing(false); 650 + this.setInvisible(false); 650 651 651 - this.setInvisible(false); 652 + var uri = this._getInlineURI(); 653 + var data = this._newRequestData('cancel'); 654 + var handler = JX.bind(this, this._onCancelResponse); 655 + 656 + this.setLoading(true); 657 + 658 + new JX.Request(uri, handler) 659 + .setData(data) 660 + .send(); 652 661 653 662 this._didUpdate(true); 663 + }, 664 + 665 + _onCancelResponse: function(response) { 666 + this.setLoading(false); 654 667 }, 655 668 656 669 _readText: function(row) {