Update TemplateDataEditor logging for IP masking

Bug: T332434
Change-Id: I9935e7d35b1cdb14c0958351cd84d9d6476d6363
This commit is contained in:
Bartosz Dziewoński 2023-04-11 21:47:29 +02:00 committed by Bartosz Dziewoński
parent 0298a2d116
commit f2c89028bd
2 changed files with 4 additions and 3 deletions

View file

@ -135,7 +135,8 @@ class Hooks {
}
$generatorUsed = RequestContext::getMain()->getRequest()->getBool( 'TemplateDataGeneratorUsed' );
$userEditCount = MediaWikiServices::getInstance()->getUserEditTracker()->getUserEditCount( $user );
$userEditCount = $services->getUserEditTracker()->getUserEditCount( $user );
$userId = $services->getUserNameUtils()->isTemp( $user->getName() ) ? 0 : $user->getId();
// Note: We know that irrelevant changes (e.g. whitespace changes) aren't logged here
EventLogging::submit(
'eventlogging_TemplateDataEditor',
@ -150,7 +151,7 @@ class Hooks {
'page_title' => $page->getDBkey(),
'rev_id' => $revisionRecord->getId() ?? 0,
'user_edit_count' => $userEditCount ?? 0,
'user_id' => $user->getId(),
'user_id' => $userId,
],
]
);

View file

@ -7,7 +7,7 @@ function logEvent( eventName ) {
page_namespace: mw.config.get( 'wgNamespaceNumber' ),
rev_id: mw.config.get( 'wgCurRevisionId' ),
user_edit_count: mw.config.get( 'wgUserEditCount', 0 ),
user_id: mw.user.getId()
user_id: mw.user.isNamed() ? mw.user.getId() : 0
};
var editCountBucket = mw.config.get( 'wgUserEditCountBucket' );