From 81ce7b08bde9250c1a1d1eb487b01875a4bd70de Mon Sep 17 00:00:00 2001 From: Martin Urbanec Date: Thu, 4 Jan 2024 13:07:24 +0100 Subject: [PATCH] Support conditional user defaults Thanks to T321527, MediaWiki makes it possible for default values of user properties to vary by user. Depends-On: I1549c3137e66801c85e03e46427e27da333d68e2 Bug: T354329 Change-Id: Ib6717be54d4f898b8b0433ee44b57f1e3e960545 --- includes/Hooks.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/Hooks.php b/includes/Hooks.php index 578f784aa..28623ea5e 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -206,9 +206,12 @@ class Hooks implements * @return void */ public function onMakeGlobalVariablesScript( &$vars, $out ): void { - $isMultimediaViewerEnable = $this->userOptionsLookup->getDefaultOption( 'multimediaviewer-enable' ); - $user = $out->getUser(); + $isMultimediaViewerEnable = $this->userOptionsLookup->getDefaultOption( + 'multimediaviewer-enable', + $user + ); + $vars['wgMediaViewerOnClick'] = $this->shouldHandleClicks( $user ); // needed because of T71942; could be different for anon and logged-in $vars['wgMediaViewerEnabledByDefault'] = (bool)$isMultimediaViewerEnable;