Glaisher has uploaded a new change for review.
https://gerrit.wikimedia.org/r/283375
Change subject: ext.thanks.revthank: Prevent double clicks while API request is
in progress
......................................................................
ext.thanks.revthank: Prevent double clicks while API request is in progress
Bug: T53303
Change-Id: Ie886a8093469904f327bba8a0b30048fc6d6b638
---
M modules/ext.thanks.revthank.js
1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Thanks
refs/changes/75/283375/1
diff --git a/modules/ext.thanks.revthank.js b/modules/ext.thanks.revthank.js
index 63f413a..3bc5069 100644
--- a/modules/ext.thanks.revthank.js
+++ b/modules/ext.thanks.revthank.js
@@ -15,6 +15,13 @@
// $thankElement is the element to be removed on success
function sendThanks( $thankLink, $thankElement ) {
var source;
+
+ if ( $thankLink.data( 'clickDisabled' ) ) {
+ // Prevent double clicks while we haven't received a
response from API request
+ return false;
+ }
+ $thankLink.data( 'clickDisabled', true );
+
if ( mw.config.get( 'wgAction' ) === 'history' ) {
source = 'history';
} else {
@@ -37,6 +44,8 @@
},
// Fail
function ( errorCode, details ) {
+ // If error occured, enable attempting to thank
again
+ $thankLink.data( 'clickDisabled', false );
// TODO: use something besides alert for the
error messages
switch ( errorCode ) {
case 'invalidrevision':
--
To view, visit https://gerrit.wikimedia.org/r/283375
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie886a8093469904f327bba8a0b30048fc6d6b638
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Thanks
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits