From b02a6e8b26b7ba9b7041b93d3d0c1dee7d1c6b66 Mon Sep 17 00:00:00 2001 From: Moriel Schottlender Date: Thu, 4 Aug 2016 13:46:46 -0700 Subject: [PATCH] Log 'mark all read' button click actions The actions logged: * Popup: Mark all notifications in the popup as read - Event ID is omitted - Context 'flyout' * Special page: Mark all notifications in current wiki as read - Event ID is omitted - Context 'archive' Bug: T127955 Change-Id: Id7c091f9e0cf0dd3745d33e335ab44706581d7f3 --- Echo.php | 2 +- modules/logger/mw.echo.Logger.js | 7 ++++--- modules/ui/mw.echo.ui.NotificationBadgeWidget.js | 8 ++++++++ modules/ui/mw.echo.ui.SpecialHelpMenuWidget.js | 10 ++++++++++ 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/Echo.php b/Echo.php index 0dcc4b7ed..d1ea43ccd 100644 --- a/Echo.php +++ b/Echo.php @@ -568,7 +568,7 @@ $wgEchoConfig = array( ), 'EchoInteraction' => array( 'enabled' => false, - 'revision' => 15180901, + 'revision' => 15823738, 'client' => true, ), ) diff --git a/modules/logger/mw.echo.Logger.js b/modules/logger/mw.echo.Logger.js index 9b6f26b91..27b007117 100644 --- a/modules/logger/mw.echo.Logger.js +++ b/modules/logger/mw.echo.Logger.js @@ -75,7 +75,8 @@ mw.echo.Logger.static.actions = { notificationClick: 'notification-link-click', notificationBundleExpand: 'notification-bundle-expand', - notificationImpression: 'notification-impression' + notificationImpression: 'notification-impression', + markAllReadClick: 'mark-all-read-click' }; /* Methods */ @@ -111,8 +112,8 @@ if ( eventType ) { myEvt.notificationType = eventType; } - if ( mobile ) { - myEvt.mobile = mobile; + if ( mobile !== undefined || mw.config.get( 'skin' ) === 'minerva' ) { + myEvt.mobile = mobile || mw.config.get( 'skin' ) === 'minerva'; } if ( notifWiki && notifWiki !== mw.config.get( 'wgDBname' ) && notifWiki !== 'local' ) { diff --git a/modules/ui/mw.echo.ui.NotificationBadgeWidget.js b/modules/ui/mw.echo.ui.NotificationBadgeWidget.js index aba957a73..c81e59ccf 100644 --- a/modules/ui/mw.echo.ui.NotificationBadgeWidget.js +++ b/modules/ui/mw.echo.ui.NotificationBadgeWidget.js @@ -294,6 +294,14 @@ * Respond to 'mark all as read' button click */ mw.echo.ui.NotificationBadgeWidget.prototype.onMarkAllReadButtonClick = function () { + // Log the click action + mw.echo.logger.logInteraction( + mw.echo.Logger.static.actions.markAllReadClick, + mw.echo.Logger.static.context.popup, + null, // Event id isn't relevant + this.manager.getTypeString() // The type of the list + ); + this.controller.markLocalNotificationsRead(); }; diff --git a/modules/ui/mw.echo.ui.SpecialHelpMenuWidget.js b/modules/ui/mw.echo.ui.SpecialHelpMenuWidget.js index 47c0133ea..7b85f3dd9 100644 --- a/modules/ui/mw.echo.ui.SpecialHelpMenuWidget.js +++ b/modules/ui/mw.echo.ui.SpecialHelpMenuWidget.js @@ -106,6 +106,16 @@ * Respond to mark all read button click */ mw.echo.ui.SpecialHelpMenuWidget.prototype.onMarkAllreadButtonClick = function () { + // Log this action + mw.echo.logger.logInteraction( + mw.echo.Logger.static.actions.markAllReadClick, + mw.echo.Logger.static.context.archive, + null, // Notification ID is irrelevant + this.manager.getTypeString(), // The type of the list in general + null, // The Logger has logic to decide whether this is mobile or not + this.manager.getFiltersModel().getSourcePagesModel().getCurrentSource() // Source name + ); + this.popup.toggle( false ); this.emit( 'markAllRead' ); };