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
This commit is contained in:
Martin Urbanec 2024-01-04 13:07:24 +01:00
parent d1c35338f0
commit 81ce7b08bd

View file

@ -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;