Only show notification after CentralAuth autologin on Vector 2022

This brings in CentralAuth for phan analysis, using config patch
8063720d68ee1d2db2c37c1ad55da3fbef688bce in CI.

Bug: T345112
Change-Id: Iddd94b38f04a34dc18df8978c2bf45e8e204a85c
This commit is contained in:
Bartosz Dziewoński 2023-08-29 20:03:09 +02:00 committed by James D. Forrester
parent 16f50e9277
commit 0bb02c9c57
3 changed files with 55 additions and 1 deletions

View file

@ -16,4 +16,20 @@
* *
*/ */
return require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php'; $cfg = require __DIR__ . '/../vendor/mediawiki/mediawiki-phan-config/src/config.php';
$cfg['directory_list'] = array_merge(
$cfg['directory_list'],
[
'../../extensions/CentralAuth',
]
);
$cfg['exclude_analysis_directory_list'] = array_merge(
$cfg['exclude_analysis_directory_list'],
[
'../../extensions/CentralAuth',
]
);
return $cfg;

View file

@ -0,0 +1,31 @@
<?php
namespace MediaWiki\Skins\Vector;
use MediaWiki\Extension\CentralAuth\Hooks\CentralAuthIsUIReloadRecommendedHook;
use MediaWiki\User\UserOptionsLookup;
use User;
/**
* @package Vector
* @internal
*/
class CentralAuthHooks implements CentralAuthIsUIReloadRecommendedHook {
private UserOptionsLookup $userOptionsLookup;
public function __construct( UserOptionsLookup $userOptionsLookup ) {
$this->userOptionsLookup = $userOptionsLookup;
}
/**
* @inheritDoc
*/
public function onCentralAuthIsUIReloadRecommended( User $user, bool &$recommendReload ) {
if ( $this->userOptionsLookup->getDefaultOption( 'skin' ) === Constants::SKIN_NAME_MODERN ) {
// Vector 2022 does not support updating the UI without reloading the page (T345112)
$recommendReload = true;
}
}
}

View file

@ -170,11 +170,18 @@
"vector-toc-pinned": 1 "vector-toc-pinned": 1
}, },
"HookHandlers": { "HookHandlers": {
"VectorCentralAuthHooks": {
"class": "MediaWiki\\Skins\\Vector\\CentralAuthHooks",
"services": [
"UserOptionsLookup"
]
},
"VectorHooks": { "VectorHooks": {
"class": "MediaWiki\\Skins\\Vector\\Hooks" "class": "MediaWiki\\Skins\\Vector\\Hooks"
} }
}, },
"Hooks": { "Hooks": {
"CentralAuthIsUIReloadRecommended": "VectorCentralAuthHooks",
"GetPreferences": "VectorHooks", "GetPreferences": "VectorHooks",
"LocalUserCreated": "VectorHooks", "LocalUserCreated": "VectorHooks",
"MakeGlobalVariablesScript": "VectorHooks", "MakeGlobalVariablesScript": "VectorHooks",