Commit e04a1a2c authored by Vitaly Slobodin's avatar Vitaly Slobodin

Merge branch 'add-note-error-handle-method' into 'master'

Add note error handler as entries for JH overriding

See merge request gitlab-org/gitlab!75489
parents 3bec37e0 988c107e
...@@ -223,17 +223,20 @@ export default { ...@@ -223,17 +223,20 @@ export default {
}) })
.catch((err) => { .catch((err) => {
this.removePlaceholderNotes(); this.removePlaceholderNotes();
const msg = __( this.handleSaveError(err); // The 'err' parameter is being used in JH, don't remove it
'Your comment could not be submitted! Please check your network connection and try again.',
);
createFlash({
message: msg,
parent: this.$el,
});
this.$refs.noteForm.note = noteText; this.$refs.noteForm.note = noteText;
callback(err); callback(err);
}); });
}, },
handleSaveError() {
const msg = __(
'Your comment could not be submitted! Please check your network connection and try again.',
);
createFlash({
message: msg,
parent: this.$el,
});
},
deleteNoteHandler(note) { deleteNoteHandler(note) {
this.$emit('noteDeleted', this.discussion, note); this.$emit('noteDeleted', this.discussion, note);
}, },
......
...@@ -331,17 +331,20 @@ export default { ...@@ -331,17 +331,20 @@ export default {
this.isEditing = true; this.isEditing = true;
this.setSelectedCommentPositionHover(); this.setSelectedCommentPositionHover();
this.$nextTick(() => { this.$nextTick(() => {
const msg = __('Something went wrong while editing your comment. Please try again.'); this.handleUpdateError(response); // The 'response' parameter is being used in JH, don't remove it
createFlash({
message: msg,
parent: this.$el,
});
this.recoverNoteContent(noteText); this.recoverNoteContent(noteText);
callback(); callback();
}); });
} }
}); });
}, },
handleUpdateError() {
const msg = __('Something went wrong while editing your comment. Please try again.');
createFlash({
message: msg,
parent: this.$el,
});
},
formCancelHandler({ shouldConfirm, isDirty }) { formCancelHandler({ shouldConfirm, isDirty }) {
if (shouldConfirm && isDirty) { if (shouldConfirm && isDirty) {
// eslint-disable-next-line no-alert // eslint-disable-next-line no-alert
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment