From 85048c96608004988f57a57358c9cda91f095e23 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sat, 11 Nov 2023 10:36:04 +0100 Subject: [PATCH] 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 --- web_src/js/features/repo-diff.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web_src/js/features/repo-diff.js b/web_src/js/features/repo-diff.js index 864b28a3bb..7d883bbc36 100644 --- a/web_src/js/features/repo-diff.js +++ b/web_src/js/features/repo-diff.js @@ -45,6 +45,9 @@ function initRepoDiffConversationForm() { e.preventDefault(); const $form = $(e.target); + if ($form.hasClass('is-loading')) return; + $form.addClass('is-loading'); + const $textArea = $form.find('textarea'); if (!validateTextareaNonEmpty($textArea)) { return;