mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-27 15:40:15 +00:00
Merge "Swap conditions in onSpecialPageBeforeExecute"
This commit is contained in:
commit
a93e9cd07c
|
@ -141,35 +141,33 @@ class Hooks implements
|
||||||
*/
|
*/
|
||||||
public function onSpecialPageBeforeExecute( $special, $subpage ) {
|
public function onSpecialPageBeforeExecute( $special, $subpage ) {
|
||||||
$name = $special->getName();
|
$name = $special->getName();
|
||||||
$out = $special->getOutput();
|
if ( !in_array( $name, [ 'Recentchanges', 'Userlogin', 'CreateAccount' ] ) ) {
|
||||||
$skin = $out->getSkin();
|
return;
|
||||||
|
}
|
||||||
|
$skin = $special->getSkin();
|
||||||
|
if ( !$skin instanceof SkinMinerva ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$request = $special->getRequest();
|
$request = $special->getRequest();
|
||||||
|
if ( $name === 'Recentchanges' ) {
|
||||||
if ( $skin instanceof SkinMinerva ) {
|
$isEnhancedDefaultForUser = MediaWikiServices::getInstance()
|
||||||
switch ( $name ) {
|
->getUserOptionsLookup()
|
||||||
case 'Recentchanges':
|
->getBoolOption( $special->getUser(), 'usenewrc' );
|
||||||
$isEnhancedDefaultForUser = MediaWikiServices::getInstance()
|
$enhanced = $request->getBool( 'enhanced', $isEnhancedDefaultForUser );
|
||||||
->getUserOptionsLookup()
|
if ( $enhanced ) {
|
||||||
->getBoolOption( $special->getUser(), 'usenewrc' );
|
$special->getOutput()->addHTML( Html::warningBox(
|
||||||
$enhanced = $request->getBool( 'enhanced', $isEnhancedDefaultForUser );
|
$special->msg( 'skin-minerva-recentchanges-warning-enhanced-not-supported' )->parse()
|
||||||
if ( $enhanced ) {
|
) );
|
||||||
$out->addHTML( Html::warningBox(
|
}
|
||||||
$special->msg( 'skin-minerva-recentchanges-warning-enhanced-not-supported' )->parse()
|
} else {
|
||||||
) );
|
// Add default warning message to Special:UserLogin and Special:UserCreate
|
||||||
}
|
// if no warning message set.
|
||||||
break;
|
if (
|
||||||
case 'Userlogin':
|
!$request->getVal( 'warning' ) &&
|
||||||
case 'CreateAccount':
|
!$special->getUser()->isRegistered() &&
|
||||||
// Add default warning message to Special:UserLogin and Special:UserCreate
|
!$request->wasPosted()
|
||||||
// if no warning message set.
|
) {
|
||||||
if (
|
$request->setVal( 'warning', 'mobile-frontend-generic-login-new' );
|
||||||
!$request->getVal( 'warning' ) &&
|
|
||||||
!$special->getUser()->isRegistered() &&
|
|
||||||
!$request->wasPosted()
|
|
||||||
) {
|
|
||||||
$request->setVal( 'warning', 'mobile-frontend-generic-login-new' );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue