EBernhardson has uploaded a new change for review. https://gerrit.wikimedia.org/r/249405
Change subject: Further cleanup of ext.wikimediaEvents.search.js ...................................................................... Further cleanup of ext.wikimediaEvents.search.js These changes were requested in review of I846752cef Change-Id: Ibb8c8ada6fb86a1832c0d24dbbac7ce2547c1cad (cherry picked from commit 4fa3c946e341e90d186a744c986d239aa485d21e) --- M modules/ext.wikimediaEvents.search.js 1 file changed, 8 insertions(+), 13 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents refs/changes/05/249405/1 diff --git a/modules/ext.wikimediaEvents.search.js b/modules/ext.wikimediaEvents.search.js index 0edd61b..cfa5c36 100644 --- a/modules/ext.wikimediaEvents.search.js +++ b/modules/ext.wikimediaEvents.search.js @@ -2,7 +2,7 @@ ( function ( $ ) { 'use strict'; - var defaults, depsPromise, sessionStartTime, + var defaults, sessionStartTime, getRandomToken = function () { return mw.user.generateRandomSessionId() + ( new Date() ).getTime().toString(); }, @@ -19,20 +19,15 @@ return; } - depsPromise = mw.loader.using( [ - 'schema.Search', - 'ext.eventLogging' - ] ); - - defaults = { - platform: 'desktop', - userSessionToken: getRandomToken(), - searchSessionToken: getRandomToken() - }; - mw.trackSubscribe( 'mediawiki.searchSuggest', function ( topic, data ) { var loggingData = { action: data.action + }; + + defaults = defaults || { + platform: 'desktop', + userSessionToken: getRandomToken(), + searchSessionToken: getRandomToken() }; if ( data.action === 'session-start' ) { @@ -51,7 +46,7 @@ } loggingData.timeOffsetSinceStart = Math.round( this.timeStamp - sessionStartTime ) ; $.extend( loggingData, defaults ); - depsPromise.then( function () { + mw.loader.using( [ 'schema.Search' ] ).then( function () { mw.eventLog.logEvent( 'Search', loggingData ); } ); } ); -- To view, visit https://gerrit.wikimedia.org/r/249405 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibb8c8ada6fb86a1832c0d24dbbac7ce2547c1cad Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikimediaEvents Gerrit-Branch: wmf/1.27.0-wmf.3 Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits