Prevent multiple codecomments to be submitted

- Utilize the existing `is-loading` class to prevent the submit code
from running twice or more.
- The `is-loading` class gives us a nice loading indicator when added to
the form.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1476
This commit is contained in:
Gusted 2023-11-11 10:36:04 +01:00
parent b1e8858de9
commit 85048c9660
No known key found for this signature in database
GPG key ID: FD821B732837125F

View file

@ -45,6 +45,9 @@ function initRepoDiffConversationForm() {
e.preventDefault(); e.preventDefault();
const $form = $(e.target); const $form = $(e.target);
if ($form.hasClass('is-loading')) return;
$form.addClass('is-loading');
const $textArea = $form.find('textarea'); const $textArea = $form.find('textarea');
if (!validateTextareaNonEmpty($textArea)) { if (!validateTextareaNonEmpty($textArea)) {
return; return;