Show users what's wrong when they try to edit an inline with an editor already open

Summary: Fixes T8572. Ideally we would probably just permit this, but clean up the behavior until the day arrives when inline code is actually rewritten.

Test Plan:
  - Tried to launch editors in Differential and Diffusion while comments were already open.
  - Verified that "Jump to inline" works in both cases.

{F788008}

{F788009}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T8572

Differential Revision: https://secure.phabricator.com/D14094
This commit is contained in:
epriestley
2015-09-10 11:36:38 -07:00
parent 738cb1fa78
commit 093a625698
4 changed files with 68 additions and 27 deletions

View File

@@ -250,12 +250,30 @@ JX.install('DifferentialInlineCommentEditor', {
JX.DifferentialInlineCommentEditor._undoRows = rows;
},
start : function() {
this._registerUndoListener();
_onBusyWorkflow: function() {
// If the user clicks the "Jump to Inline" button, scroll to the row
// being edited.
JX.DOM.scrollTo(this.getRow());
},
var data = this._buildRequestData();
start : function() {
var op = this.getOperation();
// The user is already editing a comment, we're going to give them an
// error message.
if (op == 'busy') {
var onbusy = JX.bind(this, this._onBusyWorkflow);
new JX.Workflow(this._uri, {op: op})
.setHandler(onbusy)
.start();
return this;
}
this._registerUndoListener();
var data = this._buildRequestData();
if (op == 'delete' || op == 'refdelete' || op == 'undelete') {
this._setRowState('loading');

View File

@@ -138,13 +138,23 @@ JX.behavior('differential-edit-inline-comments', function(config) {
'mousedown',
['differential-changeset', 'tag:th'],
function(e) {
if (editor ||
selecting ||
e.isRightButton() ||
if (e.isRightButton() ||
getRowNumber(e.getTarget()) === undefined) {
return;
}
if (editor) {
new JX.DifferentialInlineCommentEditor(config.uri)
.setOperation('busy')
.setRow(editor.getRow().previousSibling)
.start();
return;
}
if (selecting) {
return;
}
selecting = true;
root = e.getNode('differential-changeset');