mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-12 00:48:46 +00:00
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 Skin $skin
|
||||
*/
|
||||
public static function onRequestContextCreateSkinMobile(
|
||||
private static function setMinervaSkinOptions(
|
||||
MobileContext $mobileContext, Skin $skin
|
||||
) {
|
||||
// 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.
|
||||
* Used for setting JS variables which are pulled in dynamically with RL
|
||||
|
|
Loading…
Reference in a new issue