Merge "Fix Reply 'Done' button"
This commit is contained in:
commit
eb3d259380
@ -105,6 +105,7 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
|
||||
table.setStyleName(Gerrit.RESOURCES.css().patchContentTable());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyDraftDelta(final int delta) {
|
||||
if (fileList != null) {
|
||||
fileList.notifyDraftDelta(patchKey, delta);
|
||||
@ -406,15 +407,17 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
|
||||
newComment.setSide(side);
|
||||
newComment.setMessage("");
|
||||
|
||||
createCommentEditor(suggestRow, column, newComment).setFocus(true);
|
||||
findOrCreateCommentEditor(suggestRow, column, newComment, true)
|
||||
.setFocus(true);
|
||||
}
|
||||
} else {
|
||||
Gerrit.doSignIn(History.getToken());
|
||||
}
|
||||
}
|
||||
|
||||
private CommentEditorPanel createCommentEditor(final int suggestRow,
|
||||
final int column, final PatchLineComment newComment) {
|
||||
private CommentEditorPanel findOrCreateCommentEditor(final int suggestRow,
|
||||
final int column, final PatchLineComment newComment,
|
||||
final boolean create) {
|
||||
int row = suggestRow;
|
||||
int spans[] = new int[column + 1];
|
||||
FIND_ROW: while (row < table.getRowCount()) {
|
||||
@ -451,7 +454,7 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
|
||||
}
|
||||
}
|
||||
|
||||
if (newComment == null) {
|
||||
if (newComment == null || !create) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -819,22 +822,22 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
|
||||
private void createReplyEditor() {
|
||||
final PatchLineComment newComment = newComment();
|
||||
newComment.setMessage("");
|
||||
createEditor(newComment).setFocus(true);
|
||||
findOrCreateEditor(newComment, true).setFocus(true);
|
||||
}
|
||||
|
||||
private void cannedReply(String message) {
|
||||
final PatchLineComment newComment = newComment();
|
||||
newComment.setMessage(message);
|
||||
CommentEditorPanel p = createEditor(newComment);
|
||||
CommentEditorPanel p = findOrCreateEditor(newComment, false);
|
||||
if (p == null) {
|
||||
|
||||
enableButtons(false);
|
||||
PatchUtil.DETAIL_SVC.saveDraft(newComment,
|
||||
new GerritCallback<PatchLineComment>() {
|
||||
@Override
|
||||
public void onSuccess(final PatchLineComment result) {
|
||||
enableButtons(true);
|
||||
notifyDraftDelta(1);
|
||||
createEditor(result).setOpen(false);
|
||||
findOrCreateEditor(result, true).setOpen(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -851,10 +854,11 @@ public abstract class AbstractPatchContentTable extends NavigationTable<Object>
|
||||
}
|
||||
}
|
||||
|
||||
private CommentEditorPanel createEditor(final PatchLineComment newComment) {
|
||||
private CommentEditorPanel findOrCreateEditor(
|
||||
PatchLineComment newComment, boolean create) {
|
||||
int row = rowOf(getElement());
|
||||
int column = columnOf(getElement());
|
||||
return createCommentEditor(row + 1, column, newComment);
|
||||
return findOrCreateCommentEditor(row + 1, column, newComment, create);
|
||||
}
|
||||
|
||||
private PatchLineComment newComment() {
|
||||
|
Loading…
Reference in New Issue
Block a user