diff options
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r-- | app/assets/javascripts/notes/components/noteable_discussion.vue | 17 | ||||
-rw-r--r-- | app/assets/javascripts/notes/components/noteable_note.vue | 13 |
2 files changed, 18 insertions, 12 deletions
diff --git a/app/assets/javascripts/notes/components/noteable_discussion.vue b/app/assets/javascripts/notes/components/noteable_discussion.vue index de9c695de2e..8e32c3b3073 100644 --- a/app/assets/javascripts/notes/components/noteable_discussion.vue +++ b/app/assets/javascripts/notes/components/noteable_discussion.vue @@ -223,17 +223,20 @@ export default { }) .catch((err) => { this.removePlaceholderNotes(); - const msg = __( - 'Your comment could not be submitted! Please check your network connection and try again.', - ); - createFlash({ - message: msg, - parent: this.$el, - }); + this.handleSaveError(err); // The 'err' parameter is being used in JH, don't remove it this.$refs.noteForm.note = noteText; 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) { this.$emit('noteDeleted', this.discussion, note); }, diff --git a/app/assets/javascripts/notes/components/noteable_note.vue b/app/assets/javascripts/notes/components/noteable_note.vue index e74d4deeaec..3250a4818c7 100644 --- a/app/assets/javascripts/notes/components/noteable_note.vue +++ b/app/assets/javascripts/notes/components/noteable_note.vue @@ -331,17 +331,20 @@ export default { this.isEditing = true; this.setSelectedCommentPositionHover(); this.$nextTick(() => { - const msg = __('Something went wrong while editing your comment. Please try again.'); - createFlash({ - message: msg, - parent: this.$el, - }); + this.handleUpdateError(response); // The 'response' parameter is being used in JH, don't remove it this.recoverNoteContent(noteText); callback(); }); } }); }, + handleUpdateError() { + const msg = __('Something went wrong while editing your comment. Please try again.'); + createFlash({ + message: msg, + parent: this.$el, + }); + }, formCancelHandler({ shouldConfirm, isDirty }) { if (shouldConfirm && isDirty) { // eslint-disable-next-line no-alert |