summaryrefslogtreecommitdiffstats
path: root/web_src
diff options
context:
space:
mode:
authora1012112796 <1012112796@qq.com>2022-05-07 20:24:02 +0800
committerGitHub <noreply@github.com>2022-05-07 14:24:02 +0200
commit672e5a752db8dd732ede058f97acf5336b651afb (patch)
tree0cd66d8d12d1e9519d45366fb1845b3748fb9664 /web_src
parent0eac09e0662ae70b8b6e3e5e8c33547c79ff7124 (diff)
downloadgitea-672e5a752db8dd732ede058f97acf5336b651afb.tar.gz
gitea-672e5a752db8dd732ede058f97acf5336b651afb.zip
prevent double click new issue/pull/comment button (#16157)
* prevent double click new issue/pull/comment button when network is not good, these button maybe double clicked, then more than one same issues pulls or comments will be created. this pull request will fix this bug. Signed-off-by: a1012112796 <1012112796@qq.com>
Diffstat (limited to 'web_src')
-rw-r--r--web_src/js/features/common-global.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js
index dda803ae8d..eb21a4bb93 100644
--- a/web_src/js/features/common-global.js
+++ b/web_src/js/features/common-global.js
@@ -142,6 +142,18 @@ export function initGlobalCommon() {
window.location = href;
}
});
+
+ // loading-button this logic used to prevent push one form more than one time
+ $(document).on('click', '.button.loading-button', function (e) {
+ const $btn = $(this);
+
+ if ($btn.hasClass('loading')) {
+ e.preventDefault();
+ return false;
+ }
+
+ $btn.addClass('loading disabled');
+ });
}
export function initGlobalDropzone() {