From aa3ff56c6031dcfa71685491d6e0b6ee8398cbf4 Mon Sep 17 00:00:00 2001 From: Fatih Acet Date: Wed, 23 Aug 2017 13:25:40 +0300 Subject: IssueNotesRefactor: Empty textarea while submitting comment and restore content if request fails. --- app/assets/javascripts/notes/components/issue_comment_form.vue | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/assets/javascripts/notes/components/issue_comment_form.vue b/app/assets/javascripts/notes/components/issue_comment_form.vue index 7784b0191a2..6c3d974bc25 100644 --- a/app/assets/javascripts/notes/components/issue_comment_form.vue +++ b/app/assets/javascripts/notes/components/issue_comment_form.vue @@ -123,6 +123,7 @@ noteData.data.note.type = constants.DISCUSSION_NOTE; } this.isSubmitting = true; + this.note = ''; // Empty textarea while being requested. Repopulate in catch this.saveNote(noteData) .then((res) => { @@ -148,11 +149,9 @@ .catch(() => { this.isSubmitting = false; this.discard(false); - Flash( - 'Your comment could not be submitted! Please check your network connection and try again.', - 'alert', - $(this.$el), - ); + const msg = 'Your comment could not be submitted! Please check your network connection and try again.'; + Flash(msg, 'alert', $(this.$el)); + this.note = noteData.data.note.note; // Restore textarea content. this.removePlaceholderNotes(); }); } else { -- cgit v1.2.1