1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-09 16:32:39 +01:00

Make "Delete" from inline comment previews function correctly while editing comments

Summary: Ref T13513. Currently, if you're editing a comment, "delete" doesn't put the comment into the correct state. This action is normally only reachable from comment previews, since an editing inline has no "delete" button.

Test Plan:
  - Started editing an inline, clicked "Delete", got a deletion.
  - Created an inline, typed text,
  - Deleted a normal comment via preview.
  - Deleted a normal comment via the on-inline action.

Maniphest Tasks: T13513

Differential Revision: https://secure.phabricator.com/D21238
This commit is contained in:
epriestley 2020-05-08 07:59:18 -07:00
parent b804e8cffa
commit e7ebd5d9d1
2 changed files with 26 additions and 18 deletions

View file

@ -13,7 +13,7 @@ return array(
'core.pkg.js' => '1e667bcb',
'dark-console.pkg.js' => '187792c2',
'differential.pkg.css' => 'd71d4531',
'differential.pkg.js' => '30307170',
'differential.pkg.js' => '5be7941a',
'diffusion.pkg.css' => '42c75c37',
'diffusion.pkg.js' => 'a98c0bf7',
'maniphest.pkg.css' => '35995d6d',
@ -381,7 +381,7 @@ return array(
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => '0116d3e8',
'rsrc/js/application/diff/DiffChangeset.js' => '700bf848',
'rsrc/js/application/diff/DiffChangesetList.js' => '6e668c5b',
'rsrc/js/application/diff/DiffInline.js' => 'db754a7b',
'rsrc/js/application/diff/DiffInline.js' => '9a3963e0',
'rsrc/js/application/diff/DiffPathView.js' => '8207abf9',
'rsrc/js/application/diff/DiffTreeView.js' => '5d83623b',
'rsrc/js/application/differential/behavior-diff-radios.js' => '925fe8cd',
@ -776,7 +776,7 @@ return array(
'phabricator-dashboard-css' => '5a205b9d',
'phabricator-diff-changeset' => '700bf848',
'phabricator-diff-changeset-list' => '6e668c5b',
'phabricator-diff-inline' => 'db754a7b',
'phabricator-diff-inline' => '9a3963e0',
'phabricator-diff-path-view' => '8207abf9',
'phabricator-diff-tree-view' => '5d83623b',
'phabricator-drag-and-drop-file-upload' => '4370900d',
@ -1808,6 +1808,9 @@ return array(
'javelin-request',
'javelin-router',
),
'9a3963e0' => array(
'javelin-dom',
),
'9aae2b66' => array(
'javelin-install',
'javelin-util',
@ -2117,9 +2120,6 @@ return array(
'javelin-uri',
'phabricator-notification',
),
'db754a7b' => array(
'javelin-dom',
),
'e150bd50' => array(
'javelin-behavior',
'javelin-stratcom',

View file

@ -438,12 +438,6 @@ JX.install('DiffInline', {
op = 'delete';
}
// If there's an existing "unedit" undo element, remove it.
if (this._undoRow) {
JX.DOM.remove(this._undoRow);
this._undoRow = null;
}
var data = this._newRequestData(op);
this.setLoading(true);
@ -540,7 +534,23 @@ JX.install('DiffInline', {
},
_ondeleteresponse: function() {
this._drawUndeleteRows();
// If there's an existing "unedit" undo element, remove it.
if (this._undoRow) {
JX.DOM.remove(this._undoRow);
this._undoRow = null;
}
// If there's an existing editor, remove it. This happens when you
// delete a comment from the comment preview area. In this case, we
// read and preserve the text so "Undo" restores it.
var text;
if (this._editRow) {
text = this._readText(this._editRow);
JX.DOM.remove(this._editRow);
this._editRow = null;
}
this._drawUndeleteRows(text);
this.setLoading(false);
this.setDeleted(true);
@ -548,9 +558,9 @@ JX.install('DiffInline', {
this._didUpdate();
},
_drawUndeleteRows: function() {
_drawUndeleteRows: function(text) {
this._undoType = 'undelete';
this._undoText = null;
this._undoText = text || null;
return this._drawUndoRows('undelete', this._row);
},
@ -649,7 +659,6 @@ JX.install('DiffInline', {
},
undo: function() {
JX.DOM.remove(this._undoRow);
this._undoRow = null;
@ -666,10 +675,9 @@ JX.install('DiffInline', {
.send();
}
if (this._undoType === 'unedit') {
if (this._undoText !== null) {
this.edit(this._undoText);
}
},
_onundelete: function() {