BigW Consortium Gitlab

Commit 32ce1e3a by Jacob Schatz

Disables the button when submitting comment.

parent 2025f361
...@@ -1727,6 +1727,7 @@ export default class Notes { ...@@ -1727,6 +1727,7 @@ export default class Notes {
// Get Form metadata // Get Form metadata
const $submitBtn = $(e.target); const $submitBtn = $(e.target);
$submitBtn.prop('disabled', true);
let $form = $submitBtn.parents('form'); let $form = $submitBtn.parents('form');
const $closeBtn = $form.find('.js-note-target-close'); const $closeBtn = $form.find('.js-note-target-close');
const isDiscussionNote = const isDiscussionNote =
...@@ -1761,7 +1762,6 @@ export default class Notes { ...@@ -1761,7 +1762,6 @@ export default class Notes {
// If comment is to resolve discussion, disable submit buttons while // If comment is to resolve discussion, disable submit buttons while
// comment posting is finished. // comment posting is finished.
if (isDiscussionResolve) { if (isDiscussionResolve) {
$submitBtn.disable();
$form.find('.js-comment-submit-button').disable(); $form.find('.js-comment-submit-button').disable();
} }
...@@ -1816,6 +1816,7 @@ export default class Notes { ...@@ -1816,6 +1816,7 @@ export default class Notes {
.then(res => { .then(res => {
const note = res.data; const note = res.data;
$submitBtn.prop('disabled', false);
// Submission successful! remove placeholder // Submission successful! remove placeholder
$notesContainer.find(`#${noteUniqueId}`).remove(); $notesContainer.find(`#${noteUniqueId}`).remove();
...@@ -1899,7 +1900,7 @@ export default class Notes { ...@@ -1899,7 +1900,7 @@ export default class Notes {
.catch(() => { .catch(() => {
// Submission failed, remove placeholder note and show Flash error message // Submission failed, remove placeholder note and show Flash error message
$notesContainer.find(`#${noteUniqueId}`).remove(); $notesContainer.find(`#${noteUniqueId}`).remove();
$submitBtn.prop('disabled', false);
const blurEvent = new CustomEvent('blur.imageDiff', { const blurEvent = new CustomEvent('blur.imageDiff', {
detail: e, detail: e,
}); });
......
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