diff --git a/extension.json b/extension.json index 5201af04f..fd56d1e17 100644 --- a/extension.json +++ b/extension.json @@ -106,19 +106,6 @@ ] }, "ResourceModules": { - "ext.echo.logger": { - "packageFiles": [ - "logger/mw.echo.Logger.js", - { - "name": "logger/config.json", - "callback": "MediaWiki\\Extension\\Notifications\\Hooks::getLoggerConfigVars" - } - ], - "dependencies": [ - "oojs", - "mediawiki.user" - ] - }, "ext.echo.ui.desktop": { "scripts": [ "ui/mw.echo.ui.BadgeLinkWidget.js", @@ -191,7 +178,6 @@ "dependencies": [ "ext.echo.api", "ext.echo.dm", - "ext.echo.logger", "ext.echo.secondaryicons", "oojs", "oojs-ui-core", @@ -996,23 +982,6 @@ "EchoCacheVersion": { "value": "1.12" }, - "EchoEventLoggingVersion": { - "value": "1.12" - }, - "EchoEventLoggingSchemas": { - "value": { - "Echo": { - "enabled": false - }, - "EchoMail": { - "enabled": false - }, - "EchoInteraction": { - "enabled": false - } - }, - "merge_strategy": "array_plus_2d" - }, "AllowArticleReminderNotification": { "value": false, "description": "This is a feature flag to the Article Reminder notification" @@ -1046,14 +1015,6 @@ "description": "Maximum number of push subscriptions that may be stored in the DB at any given time for a single central user ID." } }, - "attributes": { - "EventLogging": { - "Schemas": { - "EchoInteraction": "/analytics/legacy/echointeraction/1.0.0", - "EchoMail": "/analytics/legacy/echomail/1.0.0" - } - } - }, "manifest_version": 2, "AutoloadClasses": { "BackfillUnreadWikis": "maintenance/backfillUnreadWikis.php", diff --git a/includes/EmailBatch.php b/includes/EmailBatch.php index 60db967ae..4b6a577ba 100644 --- a/includes/EmailBatch.php +++ b/includes/EmailBatch.php @@ -368,7 +368,6 @@ class EmailBatch { // @Todo Push the email to job queue or just send it out directly? UserMailer::send( $toAddress, $fromAddress, $content['subject'], $content['body'], [ 'replyTo' => $replyTo ] ); - EventLogging::logSchemaEchoMail( $this->mUser, $emailDeliveryMode ); } /** diff --git a/includes/EventLogging.php b/includes/EventLogging.php deleted file mode 100644 index f04fd9295..000000000 --- a/includes/EventLogging.php +++ /dev/null @@ -1,81 +0,0 @@ -isLoaded( 'EventLogging' ) - || !$schemaConfig['enabled'] - ) { - // If logging for this schema is disabled, it's a no-op. - return; - } - - $data['version'] = $wgEchoEventLoggingVersion; - - // NOTE: The 'EchoMail' and 'EchoInteraction' events were migrated to the Event Platform - // and are no longer using the legacy EventLogging schema from metawiki. $revId is actually - // overridden by the EventLoggingSchemas extension attribute in extension.json. - EventLoggingExt::logEvent( $schema, -1, $data ); - } - - /** - * Function for logging the event for Schema:EchoEmail - * @param UserIdentity $userIdentity - * @param string $emailDeliveryMode 'single' (default), 'daily_digest', or 'weekly_digest' - */ - public static function logSchemaEchoMail( UserIdentity $userIdentity, $emailDeliveryMode = 'single' ) { - $data = [ - 'recipientUserId' => $userIdentity->getId(), - 'emailDeliveryMode' => $emailDeliveryMode - ]; - - self::logEvent( 'EchoMail', $data ); - } - - /** - * @param UserIdentity $userIdentity - * @param string $skinName - */ - public static function logSpecialPageVisit( UserIdentity $userIdentity, $skinName ) { - $userEditCount = (int)MediaWikiServices::getInstance() - ->getUserEditTracker() - ->getUserEditCount( $userIdentity ); - self::logEvent( - 'EchoInteraction', - [ - 'context' => 'archive', - 'action' => 'special-page-visit', - 'userId' => $userIdentity->getId(), - 'editCount' => $userEditCount, - 'notifWiki' => WikiMap::getCurrentWikiId(), - // Hack: Figure out if we are in the mobile skin - 'mobile' => $skinName === 'minerva', - ] - ); - } - -} diff --git a/includes/Hooks.php b/includes/Hooks.php index 40081de04..70e7c8742 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -1465,15 +1465,6 @@ class Hooks implements ]; } - public static function getLoggerConfigVars( RL\Context $context, Config $config ) { - $schemas = $config->get( 'EchoEventLoggingSchemas' ); - return [ - 'EchoInteractionLogging' => $schemas['EchoInteraction']['enabled'] && - ExtensionRegistry::getInstance()->isLoaded( 'EventLogging' ), - 'EchoEventLoggingVersion' => $config->get( 'EchoEventLoggingVersion' ) - ]; - } - /** * @param WikiPage $article * @param User $user diff --git a/includes/Notifier.php b/includes/Notifier.php index 6f522a501..93c61458e 100644 --- a/includes/Notifier.php +++ b/includes/Notifier.php @@ -116,7 +116,6 @@ class Notifier { $options = [ 'replyTo' => $replyAddress ]; UserMailer::send( $toAddress, $fromAddress, $subject, $body, $options ); - EventLogging::logSchemaEchoMail( $user, 'single' ); } return true; diff --git a/includes/Special/SpecialNotifications.php b/includes/Special/SpecialNotifications.php index 7bd9a0fad..22d22f974 100644 --- a/includes/Special/SpecialNotifications.php +++ b/includes/Special/SpecialNotifications.php @@ -4,7 +4,6 @@ namespace MediaWiki\Extension\Notifications\Special; use Html; use MediaWiki\Extension\Notifications\DataOutputFormatter; -use MediaWiki\Extension\Notifications\EventLogging; use MediaWiki\Extension\Notifications\NotifUser; use MediaWiki\Extension\Notifications\OOUI\LabelIconWidget; use MediaWiki\Extension\Notifications\SeenTime; @@ -240,9 +239,6 @@ class SpecialNotifications extends SpecialPage { 'oojs-ui.styles.icons-alerts', 'oojs-ui.styles.icons-interactions', ] ); - - // Log visit - EventLogging::logSpecialPageVisit( $user, $out->getSkin()->getSkinName() ); } /** diff --git a/modules/logger/mw.echo.Logger.js b/modules/logger/mw.echo.Logger.js deleted file mode 100644 index 4c82926f3..000000000 --- a/modules/logger/mw.echo.Logger.js +++ /dev/null @@ -1,141 +0,0 @@ -( function () { - var configVars = require( './config.json' ); - mw.echo = mw.echo || {}; - - /** - * Echo logger - * - * @class - * - * @constructor - * @param {Object} [config] Configuration object - * @cfg {boolean} [clickThroughEnabled] Whether logging is enabled - */ - mw.echo.Logger = function MwEchoUiLogger( config ) { - config = config || {}; - - this.clickThroughEnabled = config.clickThroughEnabled || this.constructor.static.clickThroughEnabled; - this.notificationsIdCache = []; - }; - - OO.initClass( mw.echo.Logger ); - - /* Static methods */ - - /** - * Default behavior in MediaWiki for whether logging Echo interactions - * is enabled - * - * @static - * @property {boolean} - */ - mw.echo.Logger.static.clickThroughEnabled = !!configVars.EchoInteractionLogging && !mw.user.isAnon(); - - /** - * Context definitions. - * - * 'flyout': Interactions from the popup content - * 'archive': Interactions from the Special:Notifications page - * 'badge': Interactions from the badge button - * - * @static - * @property {Object} - */ - mw.echo.Logger.static.context = { - popup: 'flyout', - archive: 'archive', - badge: undefined - }; - - /** - * Logging action names for consistency. - * - * 'notificationClick': Click interaction - * 'notificationImpression': Impression interaction - * - * @static - * @property {Object} - */ - mw.echo.Logger.static.actions = { - notificationClick: 'notification-link-click', - notificationBundleExpand: 'notification-bundle-expand', - notificationImpression: 'notification-impression', - markAllReadClick: 'mark-all-read-click', - markXWikiReadClick: 'mark-entire-xwiki-bundle-read-click' - }; - - /* Methods */ - - /** - * Log all Echo interaction related events - * - * @param {string} action The interaction - * @param {string} [context] 'flyout'/'archive' or undefined for the badge - * @param {number} [eventId] Notification event id - * @param {string} [eventType] notification type - * @param {boolean} [mobile] True if interaction was on a mobile device - * @param {string} [notifWiki] Foreign wiki the notification came from - */ - mw.echo.Logger.prototype.logInteraction = function ( action, context, eventId, eventType, mobile, notifWiki ) { - var myEvt; - - if ( !this.constructor.static.clickThroughEnabled ) { - return; - } - - myEvt = { - action: action, - version: configVars.EchoEventLoggingVersion, - userId: +mw.config.get( 'wgUserId' ), - editCount: +mw.config.get( 'wgUserEditCount' ) - }; - - // All the fields below are optional - if ( context ) { - myEvt.context = context; - } - if ( eventId ) { - myEvt.eventId = Number( eventId ); - } - if ( eventType ) { - myEvt.notificationType = eventType; - } - if ( mobile !== undefined || mw.config.get( 'skin' ) === 'minerva' ) { - myEvt.mobile = mobile || mw.config.get( 'skin' ) === 'minerva'; - } - - if ( notifWiki && notifWiki !== mw.config.get( 'wgWikiID' ) && notifWiki !== 'local' ) { - myEvt.notifWiki = notifWiki; - } - - mw.track( 'event.EchoInteraction', myEvt ); - }; - - /** - * Log the impression of notifications. This will log each notification exactly once. - * - * @param {string} type Notification type; 'alert' or 'message' - * @param {number[]} notificationIds Array of notification ids - * @param {string} context 'flyout'/'archive' or undefined for the badge - * @param {string} [notifWiki='local'] Foreign wiki the notifications came from - * @param {boolean} [mobile=false] True if interaction was on a mobile device - */ - mw.echo.Logger.prototype.logNotificationImpressions = function ( type, notificationIds, context, notifWiki, mobile ) { - var i, len, key; - - for ( i = 0, len = notificationIds.length; i < len; i++ ) { - key = notifWiki && notifWiki !== mw.config.get( 'wgWikiID' ) && notifWiki !== 'local' ? - notificationIds[ i ] + '-' + notifWiki : - notificationIds[ i ]; - - if ( !this.notificationsIdCache[ key ] ) { - // Log notification impression - this.logInteraction( 'notification-impression', context, notificationIds[ i ], type, mobile, notifWiki ); - // Cache - this.notificationsIdCache[ key ] = true; - } - } - }; - - mw.echo.logger = new mw.echo.Logger(); -}() ); diff --git a/modules/ui/mw.echo.ui.BundleNotificationItemWidget.js b/modules/ui/mw.echo.ui.BundleNotificationItemWidget.js index e998f2905..7c00cb9c1 100644 --- a/modules/ui/mw.echo.ui.BundleNotificationItemWidget.js +++ b/modules/ui/mw.echo.ui.BundleNotificationItemWidget.js @@ -95,23 +95,6 @@ /* Methods */ - /** - * @inheritdoc - */ - mw.echo.ui.BundleNotificationItemWidget.prototype.onPrimaryLinkClick = function () { - // Log notification click - - mw.echo.logger.logInteraction( - mw.echo.Logger.static.actions.notificationClick, - mw.echo.Logger.static.context.popup, - this.getModel().getId(), - this.getModel().getCategory(), - false, - // Source of this notification if it is cross-wiki - this.bundle ? this.getModel().getSource() : '' - ); - }; - /** * @inheritdoc */ @@ -160,8 +143,6 @@ * Only fetch the first time we expand. */ mw.echo.ui.BundleNotificationItemWidget.prototype.expand = function () { - var widget = this; - this.toggleExpanded( !this.expanded ); this.updateExpandButton(); @@ -170,14 +151,6 @@ if ( !this.expanded ) { return; } - - // Log the expand action - mw.echo.logger.logInteraction( - mw.echo.Logger.static.actions.notificationBundleExpand, - mw.echo.Logger.static.context.popup, - widget.getModel().getId(), - widget.getModel().getCategory() - ); }; /** diff --git a/modules/ui/mw.echo.ui.CrossWikiNotificationItemWidget.js b/modules/ui/mw.echo.ui.CrossWikiNotificationItemWidget.js index 4936780e9..a40080e87 100644 --- a/modules/ui/mw.echo.ui.CrossWikiNotificationItemWidget.js +++ b/modules/ui/mw.echo.ui.CrossWikiNotificationItemWidget.js @@ -129,22 +129,6 @@ } }; - /** - * @inheritdoc - */ - mw.echo.ui.CrossWikiNotificationItemWidget.prototype.onMarkAsReadButtonClick = function () { - // Log this action - mw.echo.logger.logInteraction( - mw.echo.Logger.static.actions.markXWikiReadClick, - mw.echo.Logger.static.context.popup, - null, // Event ID is omitted - this.controller.getTypeString() // The type of the list in general - ); - - // Parent method - return mw.echo.ui.CrossWikiNotificationItemWidget.super.prototype.onMarkAsReadButtonClick.call( this ); - }; - /** * @inheritdoc */ @@ -154,23 +138,6 @@ this.controller.markEntireCrossWikiItemAsRead(); }; - /** - * @inheritdoc - */ - mw.echo.ui.CrossWikiNotificationItemWidget.prototype.onPrimaryLinkClick = function () { - // Log notification click - - mw.echo.logger.logInteraction( - mw.echo.Logger.static.actions.notificationClick, - mw.echo.Logger.static.context.popup, - this.getModel().getId(), - this.getModel().getCategory(), - false, - // Source of this notification if it is cross-wiki - this.bundle ? this.getModel().getSource() : '' - ); - }; - /** * Populate the items in this widget according to the data * in the model @@ -260,14 +227,6 @@ return; } - // Log the expand action - mw.echo.logger.logInteraction( - mw.echo.Logger.static.actions.notificationBundleExpand, - mw.echo.Logger.static.context.popup, - widget.getModel().getId(), - widget.getModel().getCategory() - ); - if ( !this.fetchedOnce ) { // Expand this.pushPending(); diff --git a/modules/ui/mw.echo.ui.NotificationBadgeWidget.js b/modules/ui/mw.echo.ui.NotificationBadgeWidget.js index 27e4c6570..9ee6058b5 100644 --- a/modules/ui/mw.echo.ui.NotificationBadgeWidget.js +++ b/modules/ui/mw.echo.ui.NotificationBadgeWidget.js @@ -270,14 +270,6 @@ * 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(); }; @@ -299,14 +291,6 @@ return; } - // Log the click event - mw.echo.logger.logInteraction( - 'ui-badge-link-click', - mw.echo.Logger.static.context.badge, - null, - this.controller.getTypeString() - ); - if ( this.hasRunFirstTime ) { // HACK: Clippable doesn't resize the clippable area when // it calculates the new size. Since the popup contents changed diff --git a/modules/ui/mw.echo.ui.SingleNotificationItemWidget.js b/modules/ui/mw.echo.ui.SingleNotificationItemWidget.js index 405ccd187..d70b11937 100644 --- a/modules/ui/mw.echo.ui.SingleNotificationItemWidget.js +++ b/modules/ui/mw.echo.ui.SingleNotificationItemWidget.js @@ -44,22 +44,6 @@ OO.mixinClass( mw.echo.ui.SingleNotificationItemWidget, OO.ui.mixin.PendingElement ); /* Methods */ - mw.echo.ui.SingleNotificationItemWidget.prototype.onPrimaryLinkClick = function () { - // Log notification click - - mw.echo.logger.logInteraction( - mw.echo.Logger.static.actions.notificationClick, - mw.echo.Logger.static.context.popup, - this.getModel().getId(), - this.getModel().getCategory(), - false, - // Source of this notification if it is cross-wiki - // TODO: For notifications in local bundles, we need - // to consider changing this - this.bundle ? this.getModel().getSource() : '' - ); - }; - /** * @inheritdoc */ diff --git a/modules/ui/mw.echo.ui.SpecialHelpMenuWidget.js b/modules/ui/mw.echo.ui.SpecialHelpMenuWidget.js index 3f84cf24d..f6bd88342 100644 --- a/modules/ui/mw.echo.ui.SpecialHelpMenuWidget.js +++ b/modules/ui/mw.echo.ui.SpecialHelpMenuWidget.js @@ -106,15 +106,6 @@ if ( data.href ) { location.href = data.href; } else if ( data === 'markAllRead' ) { - // 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.emit( 'markAllRead' ); } };