mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-09-23 18:29:49 +00:00
Fix bug in SkinVersionLookup
Bug: T299971 Change-Id: Icd8874315bf3c5846b00e8c34eb1a739c4a0feba
This commit is contained in:
parent
26835ad0ce
commit
435c903523
|
@ -108,17 +108,21 @@ final class SkinVersionLookup {
|
|||
*/
|
||||
public function getVersion(): string {
|
||||
$migrationMode = $this->config->get( 'VectorSkinMigrationMode' );
|
||||
$useSkin = $this->request->getVal(
|
||||
Constants::QUERY_PARAM_SKIN
|
||||
);
|
||||
// In migration mode, the useskin parameter is the source of truth.
|
||||
if ( $migrationMode ) {
|
||||
$useSkin = $this->request->getVal(
|
||||
Constants::QUERY_PARAM_SKIN
|
||||
);
|
||||
if ( $useSkin ) {
|
||||
return $useSkin === Constants::SKIN_NAME_LEGACY ?
|
||||
Constants::SKIN_VERSION_LEGACY :
|
||||
Constants::SKIN_VERSION_LATEST;
|
||||
}
|
||||
}
|
||||
// [[phab:T299971]]
|
||||
if ( $useSkin === Constants::SKIN_NAME_MODERN ) {
|
||||
return Constants::SKIN_VERSION_LATEST;
|
||||
}
|
||||
|
||||
// If skin key is not vector, then version should be considered legacy.
|
||||
|
||||
|
|
|
@ -36,8 +36,13 @@ class SkinVersionLookupTest extends \MediaWikiIntegrationTestCase {
|
|||
$request = $this->getMockBuilder( \WebRequest::class )->getMock();
|
||||
$request
|
||||
->method( 'getVal' )
|
||||
->with( $this->anything(), 'beta' )
|
||||
->willReturn( 'alpha' );
|
||||
->willReturnCallback( static function ( $key ) {
|
||||
if ( $key === Constants::QUERY_PARAM_SKIN ) {
|
||||
return null;
|
||||
} else {
|
||||
return 'alpha';
|
||||
}
|
||||
} );
|
||||
|
||||
$user = $this->createMock( \User::class );
|
||||
$user
|
||||
|
@ -76,8 +81,13 @@ class SkinVersionLookupTest extends \MediaWikiIntegrationTestCase {
|
|||
$request = $this->getMockBuilder( \WebRequest::class )->getMock();
|
||||
$request
|
||||
->method( 'getVal' )
|
||||
->with( $this->anything(), 'beta' )
|
||||
->willReturn( 'beta' );
|
||||
->willReturnCallback( static function ( $key ) {
|
||||
if ( $key === Constants::QUERY_PARAM_SKIN ) {
|
||||
return null;
|
||||
} else {
|
||||
return 'beta';
|
||||
}
|
||||
} );
|
||||
|
||||
$user = $this->createMock( \User::class );
|
||||
$user
|
||||
|
@ -116,8 +126,13 @@ class SkinVersionLookupTest extends \MediaWikiIntegrationTestCase {
|
|||
$request = $this->getMockBuilder( \WebRequest::class )->getMock();
|
||||
$request
|
||||
->method( 'getVal' )
|
||||
->with( $this->anything(), '1' )
|
||||
->willReturn( '1' );
|
||||
->willReturnCallback( static function ( $key ) {
|
||||
if ( $key === Constants::QUERY_PARAM_SKIN ) {
|
||||
return null;
|
||||
} else {
|
||||
return '1';
|
||||
}
|
||||
} );
|
||||
|
||||
$user = $this->createMock( \User::class );
|
||||
$user
|
||||
|
@ -296,8 +311,13 @@ class SkinVersionLookupTest extends \MediaWikiIntegrationTestCase {
|
|||
$request = $this->getMockBuilder( \WebRequest::class )->getMock();
|
||||
$request
|
||||
->method( 'getVal' )
|
||||
->with( $this->anything(), '2' )
|
||||
->willReturn( '2' );
|
||||
->willReturnCallback( static function ( $key ) {
|
||||
if ( $key === Constants::QUERY_PARAM_SKIN ) {
|
||||
return null;
|
||||
} else {
|
||||
return '2';
|
||||
}
|
||||
} );
|
||||
|
||||
$user = $this->createMock( \User::class );
|
||||
$user
|
||||
|
|
Loading…
Reference in a new issue