Jdlrobson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311753

Change subject: Dismiss event should not be tied to render method
......................................................................

Dismiss event should not be tied to render method

The dismiss event is currently a side effect of closing a popup.
This should be more closely coupled with the event that causes it.

This allows the closePopup method to be called without trigging
an event which is a necessary precursor to closing popups when
navigating away from the page.

Change-Id: I3f3c4780cc31dc8d84cdd76df2c77fa45fbea882
---
M resources/ext.popups.renderer/desktopRenderer.js
1 file changed, 14 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Popups 
refs/changes/53/311753/1

diff --git a/resources/ext.popups.renderer/desktopRenderer.js 
b/resources/ext.popups.renderer/desktopRenderer.js
index 0cb737e..16826b1 100644
--- a/resources/ext.popups.renderer/desktopRenderer.js
+++ b/resources/ext.popups.renderer/desktopRenderer.js
@@ -17,6 +17,17 @@
        }
 
        /**
+        * Logs when a popup is dismissed
+        *
+        * @param {Object} event
+        */
+       function logDismissAction() {
+               mw.track( 'ext.popups.schemaPopups', $.extend( {}, logData, {
+                       action: 'dismissed',
+                       totalInteractionTime: Math.round( mw.now() - 
logData.dwellStartTime )
+               } ) );
+       }
+       /**
         * @class mw.popups.render
         * @singleton
         */
@@ -105,6 +116,7 @@
                // link in the previous condition), then close the popup.
                if ( mw.popups.render.currentLink ) {
                        mw.popups.render.closePopup();
+                       logDismissAction();
                }
 
                // Ignore if its meant to call a function
@@ -270,11 +282,6 @@
                        }
                } );
 
-               mw.track( 'ext.popups.schemaPopups', $.extend( {}, logData, {
-                       action: 'dismissed',
-                       totalInteractionTime: Math.round( mw.now() - 
logData.dwellStartTime )
-               } ) );
-
                if ( closeTimer ) {
                        closeTimer.abort();
                }
@@ -316,6 +323,7 @@
        mw.popups.render.closeOnEsc = function ( event ) {
                if ( event.keyCode === 27 ) {
                        mw.popups.render.closePopup();
+                       logDismissAction();
                }
        };
 
@@ -329,6 +337,7 @@
        mw.popups.render.leaveActive = function () {
                closeTimer = mw.popups.render.wait( 
mw.popups.render.POPUP_CLOSE_DELAY ).done( function () {
                        mw.popups.render.closePopup();
+                       logDismissAction();
                } );
        };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3f3c4780cc31dc8d84cdd76df2c77fa45fbea882
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Popups
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to