BigW Consortium Gitlab

Commit aa3ff56c by Fatih Acet

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

parent fa482111
...@@ -123,6 +123,7 @@ ...@@ -123,6 +123,7 @@
noteData.data.note.type = constants.DISCUSSION_NOTE; noteData.data.note.type = constants.DISCUSSION_NOTE;
} }
this.isSubmitting = true; this.isSubmitting = true;
this.note = ''; // Empty textarea while being requested. Repopulate in catch
this.saveNote(noteData) this.saveNote(noteData)
.then((res) => { .then((res) => {
...@@ -148,11 +149,9 @@ ...@@ -148,11 +149,9 @@
.catch(() => { .catch(() => {
this.isSubmitting = false; this.isSubmitting = false;
this.discard(false); this.discard(false);
Flash( const msg = 'Your comment could not be submitted! Please check your network connection and try again.';
'Your comment could not be submitted! Please check your network connection and try again.', Flash(msg, 'alert', $(this.$el));
'alert', this.note = noteData.data.note.note; // Restore textarea content.
$(this.$el),
);
this.removePlaceholderNotes(); this.removePlaceholderNotes();
}); });
} else { } 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