1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-18 21:02:41 +01:00

Fix interaction between undo and inline comment placement

Summary:
Fixes T7658. Currently, we remove the "undo" before placing the comment, but that causes us to lose track of which row we should be examining.

Instead, place the comment first, then remove the "undo".

Test Plan: This stuff is hard to test comprehensively, but the original report reproduced easily and is now fixed. I wasn't able to break anything by adding/editing/deleting comments.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T7658

Differential Revision: https://secure.phabricator.com/D12157
This commit is contained in:
epriestley 2015-03-25 07:14:12 -07:00
parent 4f8147dbb8
commit c03297ab5a
2 changed files with 17 additions and 17 deletions

View file

@ -11,7 +11,7 @@ return array(
'core.pkg.js' => '75599122', 'core.pkg.js' => '75599122',
'darkconsole.pkg.js' => '8ab24e01', 'darkconsole.pkg.js' => '8ab24e01',
'differential.pkg.css' => '686ac058', 'differential.pkg.css' => '686ac058',
'differential.pkg.js' => 'e1dd7634', 'differential.pkg.js' => 'a7a75fd2',
'diffusion.pkg.css' => '591664fa', 'diffusion.pkg.css' => '591664fa',
'diffusion.pkg.js' => 'bfc0737b', 'diffusion.pkg.js' => 'bfc0737b',
'maniphest.pkg.css' => '68d4dd3d', 'maniphest.pkg.css' => '68d4dd3d',
@ -364,7 +364,7 @@ return array(
'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375', 'rsrc/js/application/dashboard/behavior-dashboard-query-panel-select.js' => '453c5375',
'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63', 'rsrc/js/application/dashboard/behavior-dashboard-tab-panel.js' => 'd4eecc63',
'rsrc/js/application/differential/ChangesetViewManager.js' => '58562350', 'rsrc/js/application/differential/ChangesetViewManager.js' => '58562350',
'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => 'f2431bc1', 'rsrc/js/application/differential/DifferentialInlineCommentEditor.js' => 'cbaf4413',
'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => 'e10f8e18', 'rsrc/js/application/differential/behavior-add-reviewers-and-ccs.js' => 'e10f8e18',
'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d', 'rsrc/js/application/differential/behavior-comment-jump.js' => '4fdb476d',
'rsrc/js/application/differential/behavior-comment-preview.js' => '8e1389b5', 'rsrc/js/application/differential/behavior-comment-preview.js' => '8e1389b5',
@ -522,7 +522,7 @@ return array(
'conpherence-widget-pane-css' => '9199d87c', 'conpherence-widget-pane-css' => '9199d87c',
'differential-changeset-view-css' => '79c27a4c', 'differential-changeset-view-css' => '79c27a4c',
'differential-core-view-css' => '7ac3cabc', 'differential-core-view-css' => '7ac3cabc',
'differential-inline-comment-editor' => 'f2431bc1', 'differential-inline-comment-editor' => 'cbaf4413',
'differential-results-table-css' => '181aa9d9', 'differential-results-table-css' => '181aa9d9',
'differential-revision-add-comment-css' => 'c478bcaa', 'differential-revision-add-comment-css' => 'c478bcaa',
'differential-revision-comment-css' => '48186045', 'differential-revision-comment-css' => '48186045',
@ -1758,6 +1758,14 @@ return array(
'javelin-stratcom', 'javelin-stratcom',
'phabricator-phtize', 'phabricator-phtize',
), ),
'cbaf4413' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-request',
'javelin-workflow',
),
'd19198c8' => array( 'd19198c8' => array(
'javelin-install', 'javelin-install',
'javelin-dom', 'javelin-dom',
@ -1905,14 +1913,6 @@ return array(
'javelin-install', 'javelin-install',
'javelin-util', 'javelin-util',
), ),
'f2431bc1' => array(
'javelin-dom',
'javelin-util',
'javelin-stratcom',
'javelin-install',
'javelin-request',
'javelin-workflow',
),
'f24f3253' => array( 'f24f3253' => array(
'javelin-behavior', 'javelin-behavior',
'javelin-dom', 'javelin-dom',

View file

@ -158,6 +158,12 @@ JX.install('DifferentialInlineCommentEditor', {
_didCompleteWorkflow : function(response) { _didCompleteWorkflow : function(response) {
var op = this.getOperation(); var op = this.getOperation();
// We don't get any markup back if the user deletes a comment, or saves
// an empty comment (which effects a delete).
if (response.markup) {
this._draw(JX.$H(response.markup).getNode());
}
if (op == 'delete' || op == 'refdelete') { if (op == 'delete' || op == 'refdelete') {
this._undoText = null; this._undoText = null;
this._drawUndo(); this._drawUndo();
@ -165,12 +171,6 @@ JX.install('DifferentialInlineCommentEditor', {
this._removeUndoLink(); this._removeUndoLink();
} }
// We don't get any markup back if the user deletes a comment, or saves
// an empty comment (which effects a delete).
if (response.markup) {
this._draw(JX.$H(response.markup).getNode());
}
// These operations remove the old row (edit adds a new row first). // These operations remove the old row (edit adds a new row first).
var remove_old = (op == 'edit' || op == 'delete' || op == 'refdelete'); var remove_old = (op == 'edit' || op == 'delete' || op == 'refdelete');
if (remove_old) { if (remove_old) {