jenkins-bot has submitted this change and it was merged.

Change subject: ext.echo.overlay: Unbreak removal logic
......................................................................


ext.echo.overlay: Unbreak removal logic

Apparently three wrongs make a right: hiding the overlay still worked.

* '#pt-notifications a' click event handler was not correctly checking
  for events comig from inside the overlay due to a missing dot before
  class name
  * But if it were correctly checking, it would not be hiding the
    overlay pokey (just its body) due to a copy-paste error
* Instead the clicks were handled by the 'body' click event handler,
  which did not correctly check for events coming from
  '#pt-notifications a'

I made things right again. The user-facing behavior is the same.

Change-Id: I02aba0e25ba4d81b234b327f120e0e2ff13d117c
---
M modules/overlay/ext.echo.overlay.js
1 file changed, 13 insertions(+), 16 deletions(-)

Approvals:
  Alex Monk: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/overlay/ext.echo.overlay.js 
b/modules/overlay/ext.echo.overlay.js
index b5d34cf..6b46223 100644
--- a/modules/overlay/ext.echo.overlay.js
+++ b/modules/overlay/ext.echo.overlay.js
@@ -21,6 +21,12 @@
 
                configuration: mw.config.get( 'wgEchoOverlayConfiguration' ),
 
+               removeOverlay: function () {
+                       $( '.mw-echo-overlay, .mw-echo-overlay-pokey' 
).fadeOut( 'fast',
+                               function () { $( this ).remove(); }
+                       );
+               },
+
                buildOverlay: function ( callback ) {
                        var notificationLimit,
                                $overlay = $( '<div>' ).addClass( 
'mw-echo-overlay' ),
@@ -264,7 +270,7 @@
                }
 
                $link.click( function ( e ) {
-                       var $target, $overlay;
+                       var $target;
 
                        e.preventDefault();
 
@@ -272,20 +278,13 @@
                        mw.echo.logInteraction( 'ui-badge-link-click' );
 
                        $target = $( e.target );
-                       // If the user clicked on the overlay or any child,
-                       //  ignore the click
-                       if ( $target.hasClass( 'mw-echo-overlay' ) ||
-                               $target.is( 'mw-echo-overlay *' )
-                       ) {
+                       // If the user clicked on the overlay or any child, 
ignore the click
+                       if ( $target.hasClass( 'mw-echo-overlay' ) || 
$target.is( '.mw-echo-overlay *' ) ) {
                                return;
                        }
 
-                       $overlay = $( '.mw-echo-overlay' );
-
-                       if ( $overlay.length ) {
-                               $overlay.fadeOut( 'fast',
-                                       function () { $overlay.remove(); }
-                               );
+                       if ( $( '.mw-echo-overlay' ).length ) {
+                               mw.echo.overlay.removeOverlay();
                                return;
                        }
 
@@ -307,10 +306,8 @@
                } );
 
                $( 'body' ).click( function ( e ) {
-                       if ( ! $( e.target ).is( '.mw-echo-overlay, 
.mw-echo-overlay *, .mw-echo-overlay-pokey' ) ) {
-                               $( '.mw-echo-overlay, .mw-echo-overlay-pokey' 
).fadeOut( 'fast',
-                                       function () { $( this ).remove(); }
-                               );
+                       if ( ! $( e.target ).is( '.mw-echo-overlay, 
.mw-echo-overlay *, .mw-echo-overlay-pokey, #pt-notifications a' ) ) {
+                               mw.echo.overlay.removeOverlay();
                        }
                } );
        } );

-- 
To view, visit https://gerrit.wikimedia.org/r/93114
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I02aba0e25ba4d81b234b327f120e0e2ff13d117c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bartosz DziewoƄski <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Bsitu <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to