Remove support for MediaWiki <= 1.39
With release of MediaWiki 1.41 we no longer need to support MW 1.39 Bug: T355105 Change-Id: I7957ca8aefee168ef11bc20905abd9944faecd73
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
"descriptionmsg": "uls-desc",
|
||||
"license-name": "GPL-2.0-or-later OR MIT",
|
||||
"requires": {
|
||||
"MediaWiki": ">= 1.39.0"
|
||||
"MediaWiki": ">= 1.40.0"
|
||||
},
|
||||
"Hooks": {
|
||||
"BeforePageDisplay": "main",
|
||||
|
||||
@@ -315,29 +315,12 @@ class Hooks implements
|
||||
// Convert BCP 47 language code to MediaWiki internal language code and
|
||||
// look for a MediaWiki internal language code that is acceptable to the client
|
||||
// and known to the wiki.
|
||||
// @begin Note: Remove this when minimum supported version is 1.40
|
||||
if ( method_exists( LanguageCode::class, 'bcp47ToInternal' ) ) {
|
||||
// @end
|
||||
foreach ( $preferred as $bcp47LangCode => $weight ) {
|
||||
$mwLangCode = LanguageCode::bcp47ToInternal( $bcp47LangCode );
|
||||
if ( isset( $supported[$mwLangCode] ) ) {
|
||||
return $mwLangCode;
|
||||
}
|
||||
}
|
||||
// @begin Note: Remove this when minimum supported version is 1.40
|
||||
} else {
|
||||
static $invertedLookup = [];
|
||||
foreach ( LanguageCode::getNonstandardLanguageCodeMapping() as $internal => $bcp47 ) {
|
||||
$invertedLookup[strtolower( $bcp47 )] = $internal;
|
||||
}
|
||||
foreach ( $preferred as $bcp47LangCode => $weight ) {
|
||||
$mwLangCode = $invertedLookup[$bcp47LangCode] ?? $bcp47LangCode;
|
||||
if ( isset( $supported[$mwLangCode] ) ) {
|
||||
return $mwLangCode;
|
||||
}
|
||||
foreach ( $preferred as $bcp47LangCode => $weight ) {
|
||||
$mwLangCode = LanguageCode::bcp47ToInternal( $bcp47LangCode );
|
||||
if ( isset( $supported[$mwLangCode] ) ) {
|
||||
return $mwLangCode;
|
||||
}
|
||||
}
|
||||
// @end
|
||||
|
||||
// Some browsers might:
|
||||
// - Sent codes like 'zh-hant-tw':
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
.uls-button-group {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
// The 1px are needed to handle overflow in .cdx-button-group in 1.39
|
||||
padding: 1px 0 0 1px;
|
||||
left: -20px;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,19 +130,16 @@
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
// This can be removed when 1.39 support is dropped.
|
||||
.uls-input-settings-inputmethods-list .cdx-radio__label,
|
||||
.checkbox.cdx-checkbox__label {
|
||||
padding-left: ~'calc(1.25em + 8px)';
|
||||
}
|
||||
|
||||
.uls-ui-languages p,
|
||||
.checkbox {
|
||||
color: @color-subtle;
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
/* @todo: Amend to use Codex when 1.39 support is no longer needed. */
|
||||
/*
|
||||
* @todo: ULS settings dialog uses buttons as tabs. Amend to use Tabs component
|
||||
* from Codex when 1.39 support is no longer needed.
|
||||
*/
|
||||
#languagesettings-panels .uls-cdx-button-pressed {
|
||||
background-color: @background-color-progressive--active;
|
||||
color: @color-inverted;
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
// Track if event logging is enabled
|
||||
mw.hook( 'mw.uls.interface.language.change' ).fire( language );
|
||||
|
||||
if ( !mw.uls.isNamed() ) {
|
||||
if ( !mw.user.isNamed() ) {
|
||||
return changeLanguageAnon();
|
||||
}
|
||||
|
||||
@@ -238,14 +238,4 @@
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine if a user is named. Wrapper method is needed since mw.user.isNamed() was added in MW 1.40
|
||||
* For MW < 1.40
|
||||
* @returns {boolean}
|
||||
*/
|
||||
mw.uls.isNamed = function () {
|
||||
return typeof mw.user.isNamed === 'function' ? mw.user.isNamed() : !mw.user.isAnon();
|
||||
};
|
||||
|
||||
}() );
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
lang, i, language, $button, autonym;
|
||||
|
||||
// Don't let anonymous users change interface language
|
||||
if ( !anonsAllowed && !mw.uls.isNamed() ) {
|
||||
if ( !anonsAllowed && !mw.user.isNamed() ) {
|
||||
$loginCta = $( '<p>' )
|
||||
.attr( 'id', 'uls-display-settings-anon-log-in-cta' );
|
||||
autonym = $.uls.data.getAutonym( this.contentLanguage );
|
||||
|
||||
@@ -121,12 +121,9 @@
|
||||
* @return {jQuery}
|
||||
*/
|
||||
function createMenuButton( buttonClass ) {
|
||||
// cdx-button--type-quiet is needed for 1.39 support.
|
||||
// Please remove when support is no longer needed.
|
||||
var classes = [
|
||||
'cdx-button',
|
||||
'cdx-button--weight-quiet',
|
||||
'cdx-button--type-quiet',
|
||||
buttonClass
|
||||
];
|
||||
// eslint-disable-next-line mediawiki/class-doc
|
||||
|
||||
@@ -28,8 +28,7 @@
|
||||
// https://www.mediawiki.org/wiki/Manual:Coding_conventions/JavaScript#Keys
|
||||
this.preferenceName = 'uls-preferences';
|
||||
this.username = mw.user.getName();
|
||||
// For MW < 1.40. ext.uls.isNamed is inlined here to avoid dependency on ext.uls.common.
|
||||
this.isNamed = typeof mw.user.isNamed === 'function' ? mw.user.isNamed() : !mw.user.isAnon();
|
||||
this.isNamed = mw.user.isNamed();
|
||||
this.preferences = null;
|
||||
this.init();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user