Commit ebf7d52d authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Hide note reply form when submitted and show it again if there is an error.

parent aa3ff56c
...@@ -110,7 +110,7 @@ ...@@ -110,7 +110,7 @@
this.resetAutoSave(); this.resetAutoSave();
this.isReplying = false; this.isReplying = false;
}, },
saveReply(noteText) { saveReply(noteText, form, callback) {
const replyData = { const replyData = {
endpoint: this.newNotePath, endpoint: this.newNotePath,
flashContainer: this.$el, flashContainer: this.$el,
...@@ -121,20 +121,22 @@ ...@@ -121,20 +121,22 @@
note: { note: noteText }, note: { note: noteText },
}, },
}; };
this.isReplying = false;
this.saveNote(replyData) this.saveNote(replyData)
.then(() => { .then(() => {
this.isReplying = false;
this.resetAutoSave(); this.resetAutoSave();
callback();
}) })
.catch(() => { .catch((err) => {
Flash(
'Your comment could not be submitted! Please check your network connection and try again.',
'alert',
$(this.$el),
);
this.removePlaceholderNotes(); 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);
});
}); });
}, },
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment