Commit aa3ff56c authored by Fatih Acet's avatar Fatih Acet

IssueNotesRefactor: Empty textarea while submitting comment and restore content if request fails.

parent fa482111
......@@ -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 {
......
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