Merge "Use mw.track() to submit EventLogging data client-side"

This commit is contained in:
jenkins-bot 2018-08-08 23:56:36 +00:00 committed by Gerrit Code Review
commit 679d892340
2 changed files with 5 additions and 30 deletions

View file

@ -143,8 +143,6 @@ class EchoHooks {
* @param ResourceLoader &$resourceLoader
*/
public static function onResourceLoaderRegisterModules( ResourceLoader &$resourceLoader ) {
global $wgEchoEventLoggingSchemas;
// ext.echo.logger is used by mobile notifications as well, so be sure not to add any
// dependencies that do not target mobile.
$definition = [
@ -159,18 +157,6 @@ class EchoHooks {
'targets' => [ 'desktop', 'mobile' ],
];
$hasSchemas = false;
foreach ( $wgEchoEventLoggingSchemas as $schema => $property ) {
if ( $property['enabled'] && $property['client'] ) {
$definition['dependencies'][] = 'schema.' . $schema;
$hasSchemas = true;
}
}
if ( $hasSchemas ) {
$definition['dependencies'][] = 'ext.eventLogging';
}
$resourceLoader->register( 'ext.echo.logger', $definition );
global $wgExtensionDirectory, $wgEchoNotificationIcons, $wgEchoSecondaryIcons;

View file

@ -15,18 +15,6 @@
this.clickThroughEnabled = config.clickThroughEnabled || this.constructor.static.clickThroughEnabled;
this.notificationsIdCache = [];
if ( this.clickThroughEnabled ) {
// This should usually already be loaded, but not always
this.deferred = mw.loader.using( 'ext.eventLogging', function () {
mw.eventLog.setDefaults( 'EchoInteraction', {
version: mw.config.get( 'wgEchoEventLoggingVersion' ),
userId: +mw.config.get( 'wgUserId' ),
editCount: +mw.config.get( 'wgUserEditCount' )
} );
} );
} else {
this.deferred = $.Deferred().resolve();
}
};
OO.initClass( mw.echo.Logger );
@ -99,7 +87,10 @@
}
myEvt = {
action: action
action: action,
version: mw.config.get( 'wgEchoEventLoggingVersion' ),
userId: +mw.config.get( 'wgUserId' ),
editCount: +mw.config.get( 'wgUserEditCount' )
};
// All the fields below are optional
@ -120,9 +111,7 @@
myEvt.notifWiki = notifWiki;
}
this.deferred.done( function () {
mw.eventLog.logEvent( 'EchoInteraction', myEvt );
} );
mw.track( 'event.EchoInteraction', myEvt );
};
/**