mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-12-01 02:37:05 +00:00
Merge "Use User->isRegistered(), not deprecated isLoggedIn()"
This commit is contained in:
commit
c07310165a
|
@ -301,7 +301,7 @@ class Hooks {
|
||||||
|
|
||||||
$user = $out->getUser();
|
$user = $out->getUser();
|
||||||
|
|
||||||
if ( $user->isLoggedIn() && self::isSkinVersionLegacy() ) {
|
if ( $user->isRegistered() && self::isSkinVersionLegacy() ) {
|
||||||
$vars[ 'wgVectorDisableSidebarPersistence' ] =
|
$vars[ 'wgVectorDisableSidebarPersistence' ] =
|
||||||
self::getConfig(
|
self::getConfig(
|
||||||
Constants::CONFIG_KEY_DISABLE_SIDEBAR_PERSISTENCE
|
Constants::CONFIG_KEY_DISABLE_SIDEBAR_PERSISTENCE
|
||||||
|
|
|
@ -134,7 +134,7 @@ class SkinVector extends SkinMustache {
|
||||||
'sidebar-visible' => $this->isSidebarVisible(),
|
'sidebar-visible' => $this->isSidebarVisible(),
|
||||||
], $this->getMenuProps() );
|
], $this->getMenuProps() );
|
||||||
|
|
||||||
if ( $skin->getUser()->isLoggedIn() ) {
|
if ( $skin->getUser()->isRegistered() ) {
|
||||||
// Note: This data is also passed to legacy template where it is unused.
|
// Note: This data is also passed to legacy template where it is unused.
|
||||||
$commonSkinData['data-emphasized-sidebar-action'] = [
|
$commonSkinData['data-emphasized-sidebar-action'] = [
|
||||||
'href' => SpecialPage::getTitleFor(
|
'href' => SpecialPage::getTitleFor(
|
||||||
|
@ -169,7 +169,7 @@ class SkinVector extends SkinMustache {
|
||||||
*/
|
*/
|
||||||
private function isSidebarVisible() {
|
private function isSidebarVisible() {
|
||||||
$skin = $this->getSkin();
|
$skin = $this->getSkin();
|
||||||
if ( $skin->getUser()->isLoggedIn() ) {
|
if ( $skin->getUser()->isRegistered() ) {
|
||||||
$userPrefSidebarState = $skin->getUser()->getOption(
|
$userPrefSidebarState = $skin->getUser()->getOption(
|
||||||
Constants::PREF_KEY_SIDEBAR_VISIBLE
|
Constants::PREF_KEY_SIDEBAR_VISIBLE
|
||||||
);
|
);
|
||||||
|
|
|
@ -109,7 +109,7 @@ final class SkinVersionLookup {
|
||||||
$this->user->getOption(
|
$this->user->getOption(
|
||||||
Constants::PREF_KEY_SKIN_VERSION,
|
Constants::PREF_KEY_SKIN_VERSION,
|
||||||
$this->config->get(
|
$this->config->get(
|
||||||
$this->user->isLoggedIn()
|
$this->user->isRegistered()
|
||||||
? Constants::CONFIG_KEY_DEFAULT_SKIN_VERSION_FOR_EXISTING_ACCOUNTS
|
? Constants::CONFIG_KEY_DEFAULT_SKIN_VERSION_FOR_EXISTING_ACCOUNTS
|
||||||
: Constants::CONFIG_KEY_DEFAULT_SKIN_VERSION
|
: Constants::CONFIG_KEY_DEFAULT_SKIN_VERSION
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,7 +39,7 @@ class SkinVersionLookupTest extends \MediaWikiTestCase {
|
||||||
|
|
||||||
$user = $this->createMock( \User::class );
|
$user = $this->createMock( \User::class );
|
||||||
$user
|
$user
|
||||||
->method( 'isLoggedIn' )
|
->method( 'isRegistered' )
|
||||||
->willReturn( false );
|
->willReturn( false );
|
||||||
$user
|
$user
|
||||||
->method( 'getOption' )
|
->method( 'getOption' )
|
||||||
|
@ -78,7 +78,7 @@ class SkinVersionLookupTest extends \MediaWikiTestCase {
|
||||||
|
|
||||||
$user = $this->createMock( \User::class );
|
$user = $this->createMock( \User::class );
|
||||||
$user
|
$user
|
||||||
->method( 'isLoggedIn' )
|
->method( 'isRegistered' )
|
||||||
->willReturn( false );
|
->willReturn( false );
|
||||||
$user
|
$user
|
||||||
->method( 'getOption' )
|
->method( 'getOption' )
|
||||||
|
@ -108,7 +108,7 @@ class SkinVersionLookupTest extends \MediaWikiTestCase {
|
||||||
* @covers ::getVersion
|
* @covers ::getVersion
|
||||||
* @covers ::isLegacy
|
* @covers ::isLegacy
|
||||||
*/
|
*/
|
||||||
public function testConfigLoggedIn() {
|
public function testConfigRegistered() {
|
||||||
$request = $this->getMockBuilder( \WebRequest::class )->getMock();
|
$request = $this->getMockBuilder( \WebRequest::class )->getMock();
|
||||||
$request
|
$request
|
||||||
->method( 'getVal' )
|
->method( 'getVal' )
|
||||||
|
@ -117,7 +117,7 @@ class SkinVersionLookupTest extends \MediaWikiTestCase {
|
||||||
|
|
||||||
$user = $this->createMock( \User::class );
|
$user = $this->createMock( \User::class );
|
||||||
$user
|
$user
|
||||||
->method( 'isLoggedIn' )
|
->method( 'isRegistered' )
|
||||||
->willReturn( true );
|
->willReturn( true );
|
||||||
$user
|
$user
|
||||||
->method( 'getOption' )
|
->method( 'getOption' )
|
||||||
|
@ -156,7 +156,7 @@ class SkinVersionLookupTest extends \MediaWikiTestCase {
|
||||||
|
|
||||||
$user = $this->createMock( \User::class );
|
$user = $this->createMock( \User::class );
|
||||||
$user
|
$user
|
||||||
->method( 'isLoggedIn' )
|
->method( 'isRegistered' )
|
||||||
->willReturn( false );
|
->willReturn( false );
|
||||||
$user
|
$user
|
||||||
->method( 'getOption' )
|
->method( 'getOption' )
|
||||||
|
|
Loading…
Reference in a new issue