Don't do logging if MobileFrontend is active for the current page

Visiting a ?action=edit URL can, depending on user settings, result in
the MobileFrontend overlay appearing on top of WikiEditor. In these
cases, don't log anything.

Bug: T320281
Change-Id: Ib98d2cd6f2e541423e5aeebd3093bad97d6fcc4f
This commit is contained in:
David Lynch 2023-03-07 11:58:43 -06:00
parent 609e1e066a
commit 843efa2f46
2 changed files with 13 additions and 0 deletions

View file

@ -122,6 +122,13 @@ class Hooks implements
if ( !$extensionRegistry->isLoaded( 'EventLogging' ) ) {
return false;
}
if ( $extensionRegistry->isLoaded( 'MobileFrontend' ) ) {
$mobFrontContext = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
if ( $mobFrontContext->shouldDisplayMobileView() ) {
// on a MobileFrontend page the logging should be handled by it
return false;
}
}
$inSample = $this->inEventSample( $data['editing_session_id'] );
$shouldOversample = $extensionRegistry->isLoaded( 'WikimediaEvents' ) &&
WikimediaEventsHooks::shouldSchemaEditAttemptStepOversample( $article->getContext() );

View file

@ -21,6 +21,12 @@
if ( mw.loader.getState( 'ext.eventLogging' ) === null ) {
return;
}
if ( mw.config.get( 'wgMFMode' ) !== null ) {
// Visiting a ?action=edit URL can, depending on user settings, result
// in the MobileFrontend overlay appearing on top of WikiEditor. In
// these cases, don't log anything.
return;
}
var args = Array.prototype.slice.call( arguments );
mw.loader.using( [ 'ext.eventLogging' ] ).done( function () {