Simplify variable assignment.

This makes the code shorter and the message is generated only in the
else path.

Change-Id: I1367280b6c154fe77b8a2cfbcdb6333aecefab53
This commit is contained in:
Fomafix
2020-01-23 11:30:56 +01:00
parent a5ae7cb556
commit 9fabb9a4ff

View File

@@ -87,10 +87,8 @@
} ).done( function () { } ).done( function () {
location.replace( currentUrlWithoutSetLang() ); location.replace( currentUrlWithoutSetLang() );
} ).fail( function ( code, result ) { } ).fail( function ( code, result ) {
var apiErrorInfo = mw.msg( 'ext-uls-setlang-unknown-error' ); var apiErrorInfo = result.error && result.error.info ||
if ( result.error && result.error.info ) { mw.msg( 'ext-uls-setlang-unknown-error' );
apiErrorInfo = result.error.info;
}
mw.notify( mw.notify(
mw.msg( 'ext-uls-setlang-error', apiErrorInfo ), mw.msg( 'ext-uls-setlang-error', apiErrorInfo ),
{ {