From 592e1151b795faa29eba8e8e13b177d2891306ee Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Thu, 17 Dec 2020 19:09:15 -0800 Subject: [PATCH] Use User->isRegistered(), not deprecated isLoggedIn() Bug: T270450 Change-Id: I60f714f42848898cf27aa83da92ac1c691fe5ead --- includes/Menu/Entries/AuthMenuEntry.php | 2 +- includes/Menu/Main/DefaultMainMenuBuilder.php | 2 +- includes/Menu/PageActions/ToolbarBuilder.php | 2 +- includes/MinervaHooks.php | 2 +- includes/Permissions/MinervaPagePermissions.php | 2 +- includes/Skins/SkinMinerva.php | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/includes/Menu/Entries/AuthMenuEntry.php b/includes/Menu/Entries/AuthMenuEntry.php index 141907b39..5222d54e4 100644 --- a/includes/Menu/Entries/AuthMenuEntry.php +++ b/includes/Menu/Entries/AuthMenuEntry.php @@ -40,7 +40,7 @@ final class AuthMenuEntry extends CompositeMenuEntry implements IProfileMenuEntr User $user, MessageLocalizer $messageLocalizer, array $authLinksQuery ) { $this->profileMenuEntry = new ProfileMenuEntry( $user ); - $entries = $user->isLoggedIn() + $entries = $user->isRegistered() ? [ $this->profileMenuEntry, new LogOutMenuEntry( diff --git a/includes/Menu/Main/DefaultMainMenuBuilder.php b/includes/Menu/Main/DefaultMainMenuBuilder.php index 51c22b7b6..094190ac8 100644 --- a/includes/Menu/Main/DefaultMainMenuBuilder.php +++ b/includes/Menu/Main/DefaultMainMenuBuilder.php @@ -110,7 +110,7 @@ final class DefaultMainMenuBuilder implements IMainMenuBuilder { $this->definitions->insertAuthMenuItem( $group ); - if ( $this->user->isLoggedIn() ) { + if ( $this->user->isRegistered() ) { $this->definitions->insertWatchlistMenuItem( $group ); $this->definitions->insertContributionsMenuItem( $group ); } diff --git a/includes/Menu/PageActions/ToolbarBuilder.php b/includes/Menu/PageActions/ToolbarBuilder.php index e2298d664..9d0ea17c7 100644 --- a/includes/Menu/PageActions/ToolbarBuilder.php +++ b/includes/Menu/PageActions/ToolbarBuilder.php @@ -236,7 +236,7 @@ class ToolbarBuilder { * @throws MWException */ protected function createWatchPageAction(): IMenuEntry { - $isWatched = $this->user->isLoggedIn() && $this->user->isWatched( $this->title ); + $isWatched = $this->user->isRegistered() && $this->user->isWatched( $this->title ); $isTempWatched = $this->watchlistExpiryEnabled && $isWatched && $this->user->isTempWatched( $this->title ); diff --git a/includes/MinervaHooks.php b/includes/MinervaHooks.php index 88e1eaac3..18104635e 100644 --- a/includes/MinervaHooks.php +++ b/includes/MinervaHooks.php @@ -186,7 +186,7 @@ class MinervaHooks { // if no warning message set. if ( !$request->getVal( 'warning' ) && - !$special->getUser()->isLoggedIn() && + !$special->getUser()->isRegistered() && !$request->wasPosted() ) { $request->setVal( 'warning', 'mobile-frontend-generic-login-new' ); diff --git a/includes/Permissions/MinervaPagePermissions.php b/includes/Permissions/MinervaPagePermissions.php index 15ce86e55..3c610dadd 100644 --- a/includes/Permissions/MinervaPagePermissions.php +++ b/includes/Permissions/MinervaPagePermissions.php @@ -187,7 +187,7 @@ final class MinervaPagePermissions implements IMinervaPagePermissions { return $this->isAllowed( self::TALK ) && ( $this->title->isTalkPage() || $this->title->canHaveTalkPage() ) && - $this->user->isLoggedIn(); + $this->user->isRegistered(); } /** diff --git a/includes/Skins/SkinMinerva.php b/includes/Skins/SkinMinerva.php index 8f19afeda..eeaa8e136 100644 --- a/includes/Skins/SkinMinerva.php +++ b/includes/Skins/SkinMinerva.php @@ -240,7 +240,7 @@ class SkinMinerva extends SkinMustache { $className .= ' page-Main_Page '; } - if ( $this->getUser()->isLoggedIn() ) { + if ( $this->getUser()->isRegistered() ) { $className .= ' is-authenticated'; } // The new treatment should only apply to the main namespace @@ -288,7 +288,7 @@ class SkinMinerva extends SkinMustache { $notificationIconClass = MinervaUI::iconClass( 'bellOutline-base20', 'element', '', 'wikimedia' ); - if ( $user->isLoggedIn() ) { + if ( $user->isRegistered() ) { $badge = Html::element( 'a', [ 'class' => $notificationIconClass, 'href' => SpecialPage::getTitleFor( 'Mytalk' )->getLocalURL( @@ -543,7 +543,7 @@ class SkinMinerva extends SkinMustache { $pageTitle = ''; $msg = $this->msg( 'mobile-frontend-logged-in-homepage-notification', $user->getName() ); - if ( $user->isLoggedIn() && !$msg->isDisabled() ) { + if ( $user->isRegistered() && !$msg->isDisabled() ) { $pageTitle = $msg->text(); } @@ -822,7 +822,7 @@ class SkinMinerva extends SkinMustache { $styles[] = 'skins.minerva.talk.styles'; } - if ( $this->getUser()->isLoggedIn() ) { + if ( $this->getUser()->isRegistered() ) { $styles[] = 'skins.minerva.loggedin.styles'; $styles[] = 'skins.minerva.icons.loggedin'; }