Merge "Reset SkinOptions after logging out"
This commit is contained in:
commit
d8de612e0c
|
@ -221,12 +221,12 @@ class MinervaHooks {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BeforePageDisplayMobile hook handler.
|
* Set the skin options for Minerva
|
||||||
*
|
*
|
||||||
* @param MobileContext $mobileContext
|
* @param MobileContext $mobileContext
|
||||||
* @param Skin $skin
|
* @param Skin $skin
|
||||||
*/
|
*/
|
||||||
public static function onRequestContextCreateSkinMobile(
|
private static function setMinervaSkinOptions(
|
||||||
MobileContext $mobileContext, Skin $skin
|
MobileContext $mobileContext, Skin $skin
|
||||||
) {
|
) {
|
||||||
// setSkinOptions is not available
|
// setSkinOptions is not available
|
||||||
|
@ -267,6 +267,34 @@ class MinervaHooks {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UserLogoutComplete hook handler.
|
||||||
|
* Resets skin options if a user logout occurs - this is necessary as the
|
||||||
|
* RequestContextCreateSkinMobile hook runs before the UserLogout hook.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
*/
|
||||||
|
public static function onUserLogoutComplete( User $user ) {
|
||||||
|
try {
|
||||||
|
$ctx = MediaWikiServices::getInstance()->getService( 'MobileFrontend.Context' );
|
||||||
|
self::setMinervaSkinOptions( $ctx, $ctx->getSkin() );
|
||||||
|
} catch ( Wikimedia\Services\NoSuchServiceException $ex ) {
|
||||||
|
// MobileFrontend not installed. Not important.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BeforePageDisplayMobile hook handler.
|
||||||
|
*
|
||||||
|
* @param MobileContext $mobileContext
|
||||||
|
* @param Skin $skin
|
||||||
|
*/
|
||||||
|
public static function onRequestContextCreateSkinMobile(
|
||||||
|
MobileContext $mobileContext, Skin $skin
|
||||||
|
) {
|
||||||
|
self::setMinervaSkinOptions( $mobileContext, $skin );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ResourceLoaderGetConfigVars hook handler.
|
* ResourceLoaderGetConfigVars hook handler.
|
||||||
* Used for setting JS variables which are pulled in dynamically with RL
|
* Used for setting JS variables which are pulled in dynamically with RL
|
||||||
|
|
|
@ -93,6 +93,9 @@
|
||||||
"minerva": "GlobalVarConfig::newInstance"
|
"minerva": "GlobalVarConfig::newInstance"
|
||||||
},
|
},
|
||||||
"Hooks": {
|
"Hooks": {
|
||||||
|
"UserLogoutComplete": [
|
||||||
|
"MinervaHooks::onUserLogoutComplete"
|
||||||
|
],
|
||||||
"FetchChangesList": [
|
"FetchChangesList": [
|
||||||
"MinervaHooks::onFetchChangesList"
|
"MinervaHooks::onFetchChangesList"
|
||||||
],
|
],
|
||||||
|
|
Loading…
Reference in New Issue