mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-29 18:22:41 +01:00
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
This commit is contained in:
parent
b48a22bf50
commit
b2ce0844b6
3 changed files with 33 additions and 7 deletions
|
@ -13,7 +13,7 @@ return array(
|
||||||
'core.pkg.js' => '632fb8f5',
|
'core.pkg.js' => '632fb8f5',
|
||||||
'dark-console.pkg.js' => '187792c2',
|
'dark-console.pkg.js' => '187792c2',
|
||||||
'differential.pkg.css' => '2d70b7b9',
|
'differential.pkg.css' => '2d70b7b9',
|
||||||
'differential.pkg.js' => 'b289f75d',
|
'differential.pkg.js' => 'b35de23a',
|
||||||
'diffusion.pkg.css' => '42c75c37',
|
'diffusion.pkg.css' => '42c75c37',
|
||||||
'diffusion.pkg.js' => 'a98c0bf7',
|
'diffusion.pkg.js' => 'a98c0bf7',
|
||||||
'maniphest.pkg.css' => '35995d6d',
|
'maniphest.pkg.css' => '35995d6d',
|
||||||
|
@ -381,7 +381,7 @@ return array(
|
||||||
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
|
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
|
||||||
'rsrc/js/application/diff/DiffChangeset.js' => '9a713ba5',
|
'rsrc/js/application/diff/DiffChangeset.js' => '9a713ba5',
|
||||||
'rsrc/js/application/diff/DiffChangesetList.js' => '10726e6a',
|
'rsrc/js/application/diff/DiffChangesetList.js' => '10726e6a',
|
||||||
'rsrc/js/application/diff/DiffInline.js' => '7b0bdd6d',
|
'rsrc/js/application/diff/DiffInline.js' => '02791ed9',
|
||||||
'rsrc/js/application/diff/DiffPathView.js' => '8207abf9',
|
'rsrc/js/application/diff/DiffPathView.js' => '8207abf9',
|
||||||
'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b',
|
'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b',
|
||||||
'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17',
|
'rsrc/js/application/diff/behavior-preview-link.js' => 'f51e9c17',
|
||||||
|
@ -778,7 +778,7 @@ return array(
|
||||||
'phabricator-dashboard-css' => '5a205b9d',
|
'phabricator-dashboard-css' => '5a205b9d',
|
||||||
'phabricator-diff-changeset' => '9a713ba5',
|
'phabricator-diff-changeset' => '9a713ba5',
|
||||||
'phabricator-diff-changeset-list' => '10726e6a',
|
'phabricator-diff-changeset-list' => '10726e6a',
|
||||||
'phabricator-diff-inline' => '7b0bdd6d',
|
'phabricator-diff-inline' => '02791ed9',
|
||||||
'phabricator-diff-path-view' => '8207abf9',
|
'phabricator-diff-path-view' => '8207abf9',
|
||||||
'phabricator-diff-tree-view' => '5d83623b',
|
'phabricator-diff-tree-view' => '5d83623b',
|
||||||
'phabricator-drag-and-drop-file-upload' => '4370900d',
|
'phabricator-drag-and-drop-file-upload' => '4370900d',
|
||||||
|
@ -944,6 +944,9 @@ return array(
|
||||||
'javelin-leader',
|
'javelin-leader',
|
||||||
'javelin-json',
|
'javelin-json',
|
||||||
),
|
),
|
||||||
|
'02791ed9' => array(
|
||||||
|
'javelin-dom',
|
||||||
|
),
|
||||||
'02cb4398' => array(
|
'02cb4398' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-dom',
|
'javelin-dom',
|
||||||
|
@ -1616,9 +1619,6 @@ return array(
|
||||||
'phabricator-drag-and-drop-file-upload',
|
'phabricator-drag-and-drop-file-upload',
|
||||||
'phabricator-textareautils',
|
'phabricator-textareautils',
|
||||||
),
|
),
|
||||||
'7b0bdd6d' => array(
|
|
||||||
'javelin-dom',
|
|
||||||
),
|
|
||||||
'7b139193' => array(
|
'7b139193' => array(
|
||||||
'javelin-behavior',
|
'javelin-behavior',
|
||||||
'javelin-stratcom',
|
'javelin-stratcom',
|
||||||
|
|
|
@ -215,6 +215,19 @@ abstract class PhabricatorInlineCommentController
|
||||||
$view = $this->buildScaffoldForView($edit_dialog);
|
$view = $this->buildScaffoldForView($edit_dialog);
|
||||||
|
|
||||||
return $this->newInlineResponse($inline, $view);
|
return $this->newInlineResponse($inline, $view);
|
||||||
|
case 'cancel':
|
||||||
|
$inline = $this->loadCommentForEdit($this->getCommentID());
|
||||||
|
|
||||||
|
$inline->setIsEditing(false);
|
||||||
|
|
||||||
|
$content = $inline->getContent();
|
||||||
|
if (!strlen($content)) {
|
||||||
|
$this->deleteComment($inline);
|
||||||
|
} else {
|
||||||
|
$this->saveComment($inline);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->buildEmptyResponse();
|
||||||
case 'new':
|
case 'new':
|
||||||
case 'reply':
|
case 'reply':
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -647,12 +647,25 @@ JX.install('DiffInline', {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setEditing(false);
|
this.setEditing(false);
|
||||||
|
|
||||||
this.setInvisible(false);
|
this.setInvisible(false);
|
||||||
|
|
||||||
|
var uri = this._getInlineURI();
|
||||||
|
var data = this._newRequestData('cancel');
|
||||||
|
var handler = JX.bind(this, this._onCancelResponse);
|
||||||
|
|
||||||
|
this.setLoading(true);
|
||||||
|
|
||||||
|
new JX.Request(uri, handler)
|
||||||
|
.setData(data)
|
||||||
|
.send();
|
||||||
|
|
||||||
this._didUpdate(true);
|
this._didUpdate(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onCancelResponse: function(response) {
|
||||||
|
this.setLoading(false);
|
||||||
|
},
|
||||||
|
|
||||||
_readText: function(row) {
|
_readText: function(row) {
|
||||||
var textarea;
|
var textarea;
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in a new issue