diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-08-23 15:40:52 +0300 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-08-23 15:41:07 +0300 |
commit | ebf7d52d7c994aab7c9890587a23f0fe7a049611 (patch) | |
tree | b5ace894beb245d6c02f8c5cd630101c623dcaec /app/assets/javascripts/notes | |
parent | aa3ff56c6031dcfa71685491d6e0b6ee8398cbf4 (diff) |
IssueNotesRefactor: Hide note reply form when submitted and show it again if there is an error.
Diffstat (limited to 'app/assets/javascripts/notes')
-rw-r--r-- | app/assets/javascripts/notes/components/issue_discussion.vue | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/app/assets/javascripts/notes/components/issue_discussion.vue b/app/assets/javascripts/notes/components/issue_discussion.vue index 6fdc85e52e3..b131ef4b182 100644 --- a/app/assets/javascripts/notes/components/issue_discussion.vue +++ b/app/assets/javascripts/notes/components/issue_discussion.vue @@ -110,7 +110,7 @@ this.resetAutoSave(); this.isReplying = false; }, - saveReply(noteText) { + saveReply(noteText, form, callback) { const replyData = { endpoint: this.newNotePath, flashContainer: this.$el, @@ -121,20 +121,22 @@ note: { note: noteText }, }, }; + this.isReplying = false; this.saveNote(replyData) .then(() => { - this.isReplying = false; this.resetAutoSave(); + callback(); }) - .catch(() => { - Flash( - 'Your comment could not be submitted! Please check your network connection and try again.', - 'alert', - $(this.$el), - ); + .catch((err) => { this.removePlaceholderNotes(); - this.$refs.noteForm.isSubmitting = false; + this.isReplying = true; + this.$nextTick(() => { + const msg = 'Your comment could not be submitted! Please check your network connection and try again.'; + Flash(msg, 'alert', $(this.$el)); + this.$refs.noteForm.note = noteText; + callback(err); + }); }); }, }, |