Prevent double-clicking on badge when initializing

Double-clicking would just recreate the badge midway while it is
being created, and produce 2 popups simultaneously. This patch
ignores the second click in a double-click until the widget is
being replaced anyways.

Bug: T184883
Change-Id: I2fda8df36b3828dbbe0d9b7892f159e598c630bd
This commit is contained in:
Moriel Schottlender 2018-02-23 14:35:33 -08:00
parent 38ec20ce27
commit b2f2ef9114

View file

@ -36,10 +36,12 @@
var time = mw.now(),
myType = $( this ).parent().prop( 'id' ) === 'pt-notifications-alert' ? 'alert' : 'message';
if ( e.which !== 1 ) {
return;
if ( e.which !== 1 || $( this ).data( 'clicked' ) ) {
return false;
}
$( this ).data( 'clicked', true );
// Dim the button while we load
$( this ).addClass( 'mw-echo-notifications-badge-dimmed' );