Merge "Hygiene: Various cleanup in Minerva PHP code"

This commit is contained in:
jenkins-bot 2019-04-20 00:50:19 +00:00 committed by Gerrit Code Review
commit efcc4792a4
3 changed files with 12 additions and 17 deletions

View file

@ -71,7 +71,7 @@ final class Definitions {
$group->insert( 'contribs' ) $group->insert( 'contribs' )
->addComponent( ->addComponent(
$this->context->msg( 'mobile-frontend-main-menu-contributions' )->escaped(), $this->context->msg( 'mobile-frontend-main-menu-contributions' )->escaped(),
SpecialPage::getTitleFor( 'Contributions', $this->user->getName() )->getLocalUrl(), SpecialPage::getTitleFor( 'Contributions', $this->user->getName() )->getLocalURL(),
MinervaUI::iconClass( 'contributions', 'before' ), MinervaUI::iconClass( 'contributions', 'before' ),
[ 'data-event-name' => 'contributions' ] [ 'data-event-name' => 'contributions' ]
); );
@ -142,7 +142,7 @@ final class Definitions {
$group->insert( 'auth', false ) $group->insert( 'auth', false )
->addComponent( ->addComponent(
$username, $username,
Title::newFromText( $username, NS_USER )->getLocalUrl(), Title::newFromText( $username, NS_USER )->getLocalURL(),
MinervaUI::iconClass( 'profile', 'before', 'truncated-text primary-action' ), MinervaUI::iconClass( 'profile', 'before', 'truncated-text primary-action' ),
[ 'data-event-name' => 'profile' ] [ 'data-event-name' => 'profile' ]
) )
@ -177,7 +177,7 @@ final class Definitions {
$group->insert( 'home' ) $group->insert( 'home' )
->addComponent( ->addComponent(
$this->context->msg( 'mobile-frontend-home-button' )->escaped(), $this->context->msg( 'mobile-frontend-home-button' )->escaped(),
Title::newMainPage()->getLocalUrl(), Title::newMainPage()->getLocalURL(),
MinervaUI::iconClass( 'home', 'before' ), MinervaUI::iconClass( 'home', 'before' ),
[ 'data-event-name' => 'home' ] [ 'data-event-name' => 'home' ]
); );
@ -192,7 +192,7 @@ final class Definitions {
// Random link // Random link
$group->insert( 'random' ) $group->insert( 'random' )
->addComponent( $this->context->msg( 'mobile-frontend-random-button' )->escaped(), ->addComponent( $this->context->msg( 'mobile-frontend-random-button' )->escaped(),
SpecialPage::getTitleFor( 'Randompage' )->getLocalUrl() . '#/random', SpecialPage::getTitleFor( 'Randompage' )->getLocalURL() . '#/random',
MinervaUI::iconClass( 'random', 'before' ), [ MinervaUI::iconClass( 'random', 'before' ), [
'id' => 'randomButton', 'id' => 'randomButton',
'data-event-name' => 'random', 'data-event-name' => 'random',
@ -259,7 +259,7 @@ final class Definitions {
$msg = $this->context->msg( 'aboutsite' ); $msg = $this->context->msg( 'aboutsite' );
if ( $title && !$msg->isDisabled() ) { if ( $title && !$msg->isDisabled() ) {
$group->insert( 'about' ) $group->insert( 'about' )
->addComponent( $msg->text(), $title->getLocalUrl() ); ->addComponent( $msg->text(), $title->getLocalURL() );
} }
} }
@ -273,7 +273,7 @@ final class Definitions {
$msg = $this->context->msg( 'disclaimers' ); $msg = $this->context->msg( 'disclaimers' );
if ( $title && !$msg->isDisabled() ) { if ( $title && !$msg->isDisabled() ) {
$group->insert( 'disclaimers' ) $group->insert( 'disclaimers' )
->addComponent( $msg->text(), $title->getLocalUrl() ); ->addComponent( $msg->text(), $title->getLocalURL() );
} }
} }

View file

@ -262,7 +262,7 @@ class MinervaTemplate extends BaseTemplate {
'headinghtml' => isset( $data['headinghtml'] ) ? $data['headinghtml'] : '', 'headinghtml' => isset( $data['headinghtml'] ) ? $data['headinghtml'] : '',
'postheadinghtml' => isset( $data['postheadinghtml'] ) ? $data['postheadinghtml'] : '', 'postheadinghtml' => isset( $data['postheadinghtml'] ) ? $data['postheadinghtml'] : '',
'haspageactions' => $hasPageActions, 'haspageactions' => $hasPageActions,
'pageactionshtml' => $hasPageActions ? $this->getPageActionsHtml( $data ) : '', 'pageactionshtml' => $hasPageActions ? $this->getPageActionsHtml() : '',
'subtitle' => $data['subtitle'], 'subtitle' => $data['subtitle'],
'contenthtml' => $this->getContentHtml( $data ), 'contenthtml' => $this->getContentHtml( $data ),
'secondaryactionshtml' => $this->getSecondaryActionsHtml(), 'secondaryactionshtml' => $this->getSecondaryActionsHtml(),

View file

@ -1125,21 +1125,16 @@ class SkinMinerva extends SkinTemplate {
public function getContextSpecificModules() { public function getContextSpecificModules() {
$modules = []; $modules = [];
$user = $this->getUser(); $user = $this->getUser();
$req = $this->getRequest();
$title = $this->getTitle(); $title = $this->getTitle();
if ( !$title->isSpecialPage() ) { if ( !$title->isSpecialPage() && $this->isAllowedPageAction( 'watch' ) ) {
if ( $this->isAllowedPageAction( 'watch' ) ) {
// Explicitly add the mobile watchstar code. // Explicitly add the mobile watchstar code.
$modules[] = 'skins.minerva.watchstar'; $modules[] = 'skins.minerva.watchstar';
} }
}
if ( $user->isLoggedIn() ) { if ( $user->isLoggedIn() && $this->useEcho() ) {
if ( $this->useEcho() ) {
$modules[] = 'skins.minerva.notifications'; $modules[] = 'skins.minerva.notifications';
} }
}
// TalkOverlay feature // TalkOverlay feature
if ( if (