Merge "Streamline user options check for readability"

This commit is contained in:
jenkins-bot 2022-10-16 19:41:01 +00:00 committed by Gerrit Code Review
commit 90d4a066b4

View file

@ -81,17 +81,11 @@ class Hooks implements MakeGlobalVariablesScriptHook {
global $wgMediaViewerEnableByDefaultForAnonymous,
$wgMediaViewerEnableByDefault;
if ( $wgMediaViewerEnableByDefaultForAnonymous === null ) {
$enableByDefaultForAnons = $wgMediaViewerEnableByDefault;
} else {
$enableByDefaultForAnons = $wgMediaViewerEnableByDefaultForAnonymous;
}
if ( !$performer->isRegistered() ) {
return (bool)$enableByDefaultForAnons;
} else {
if ( $performer->isRegistered() ) {
return (bool)$this->userOptionsLookup->getOption( $performer, 'multimediaviewer-enable' );
}
return (bool)( $wgMediaViewerEnableByDefaultForAnonymous ?? $wgMediaViewerEnableByDefault );
}
/**