mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-09-23 10:21:40 +00:00
Merge "Make use of named MainConfigNames::… constants"
This commit is contained in:
commit
6a52ec3b58
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace MediaWiki\Skins\Vector\ResourceLoader;
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\ResourceLoader as RL;
|
||||
use MediaWiki\Skins\Vector\Constants;
|
||||
|
||||
|
@ -10,11 +11,12 @@ class VectorResourceLoaderUserModule extends RL\UserModule {
|
|||
* @inheritDoc
|
||||
*/
|
||||
protected function getPages( RL\Context $context ) {
|
||||
$skin = $context->getSkin();
|
||||
$config = $this->getConfig();
|
||||
$user = $context->getUserObj();
|
||||
$pages = [];
|
||||
if ( $config->get( 'AllowUserCss' ) && !$user->isAnon() && ( $skin === Constants::SKIN_NAME_MODERN ) ) {
|
||||
if ( $context->getSkin() === Constants::SKIN_NAME_MODERN &&
|
||||
$this->getConfig()->get( MainConfigNames::AllowUserCss ) &&
|
||||
$user->isRegistered()
|
||||
) {
|
||||
$userPage = $user->getUserPage()->getPrefixedDBkey();
|
||||
$pages["$userPage/vector.js"] = [ 'type' => 'script' ];
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace MediaWiki\Skins\Vector\ResourceLoader;
|
||||
|
||||
use MediaWiki\MainConfigNames;
|
||||
use MediaWiki\ResourceLoader as RL;
|
||||
use MediaWiki\Skins\Vector\Constants;
|
||||
|
||||
|
@ -10,11 +11,12 @@ class VectorResourceLoaderUserStylesModule extends RL\UserStylesModule {
|
|||
* @inheritDoc
|
||||
*/
|
||||
protected function getPages( RL\Context $context ) {
|
||||
$skin = $context->getSkin();
|
||||
$config = $this->getConfig();
|
||||
$user = $context->getUserObj();
|
||||
$pages = [];
|
||||
if ( $config->get( 'AllowUserCss' ) && !$user->isAnon() && ( $skin === Constants::SKIN_NAME_MODERN ) ) {
|
||||
if ( $context->getSkin() === Constants::SKIN_NAME_MODERN &&
|
||||
$this->getConfig()->get( MainConfigNames::AllowUserCss ) &&
|
||||
$user->isRegistered()
|
||||
) {
|
||||
$userPage = $user->getUserPage()->getPrefixedDBkey();
|
||||
$pages["$userPage/vector.css"] = [ 'type' => 'style' ];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue