Skip to content

Commit

Permalink
Use getDefaultModules instead of construct for modules (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
lens0021 committed Nov 7, 2021
1 parent fa8f27a commit 0d52e26
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions includes/SkinFemiwiki.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@ class SkinFemiwiki extends SkinMustache {
/**
* @inheritDoc
*/
public function __construct( $options = [] ) {
public function getDefaultModules() {
$user = $this->getUser();
$registered = $user->isRegistered();
$config = $this->getConfig();
$userOptionsLookup = MediaWikiServices::getInstance()->getUserOptionsLookup();

if ( $registered ) {
$options['scripts'][] = 'skins.femiwiki.notifications';
$this->options['scripts'][] = 'skins.femiwiki.notifications';
}
if ( $this->shouldShowShare() ) {
$options['scripts'][] = 'skins.femiwiki.share';
$this->options['scripts'][] = 'skins.femiwiki.share';
}
if (
( !$registered && $config->get( Constants::CONFIG_KEY_SMALL_ELEMENTS_FOR_ANONYMOUS_USER ) )
|| ( $registered && $userOptionsLookup->getOption( $user, Constants::PREF_KEY_LARGER_ELEMENTS, '0' ) === '0' )
) {
$options['styles'][] = 'skins.femiwiki.smallElements';
$this->options['styles'][] = 'skins.femiwiki.smallElements';
}
parent::__construct( $options );
return parent::getDefaultModules();
}

/**
Expand Down

0 comments on commit 0d52e26

Please sign in to comment.