From 9fabb9a4ff189c5ae7e582b912a35303e695eaaa Mon Sep 17 00:00:00 2001 From: Fomafix Date: Thu, 23 Jan 2020 11:30:56 +0100 Subject: [PATCH] Simplify variable assignment. This makes the code shorter and the message is generated only in the else path. Change-Id: I1367280b6c154fe77b8a2cfbcdb6333aecefab53 --- resources/js/ext.uls.setlang.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/js/ext.uls.setlang.js b/resources/js/ext.uls.setlang.js index 84f0251a..c26a01ee 100644 --- a/resources/js/ext.uls.setlang.js +++ b/resources/js/ext.uls.setlang.js @@ -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 ), {