Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2017-08-23 15:40:52 +0300
committerFatih Acet <acetfatih@gmail.com>2017-08-23 15:41:07 +0300
commitebf7d52d7c994aab7c9890587a23f0fe7a049611 (patch)
treeb5ace894beb245d6c02f8c5cd630101c623dcaec /app/assets/javascripts/notes
parentaa3ff56c6031dcfa71685491d6e0b6ee8398cbf4 (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.vue20
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);
+ });
});
},
},