summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2017-08-23 13:25:40 +0300
committerFatih Acet <acetfatih@gmail.com>2017-08-23 15:41:07 +0300
commitaa3ff56c6031dcfa71685491d6e0b6ee8398cbf4 (patch)
treed4c9e66e4bce220a131db0153dc610f4d84afdbc
parentfa482111a482abbe1e319df5c2b86250d6d8950c (diff)
downloadgitlab-ce-aa3ff56c6031dcfa71685491d6e0b6ee8398cbf4.tar.gz
IssueNotesRefactor: Empty textarea while submitting comment and restore content if request fails.
-rw-r--r--app/assets/javascripts/notes/components/issue_comment_form.vue9
1 files 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 {