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 () {
location.replace( currentUrlWithoutSetLang() );
} ).fail( function ( code, result ) {
var apiErrorInfo = mw.msg( 'ext-uls-setlang-unknown-error' );
if ( result.error && result.error.info ) {
apiErrorInfo = result.error.info;
}
var apiErrorInfo = result.error && result.error.info ||
mw.msg( 'ext-uls-setlang-unknown-error' );
mw.notify(
mw.msg( 'ext-uls-setlang-error', apiErrorInfo ),
{