mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-24 07:54:13 +00:00
Merge "Use mw.track() to submit EventLogging data client-side"
This commit is contained in:
commit
679d892340
|
@ -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;
|
||||
|
|
|
@ -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 );
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue