Pass uselang=user to the API instead of figuring it out client side

Change-Id: I09add693567af577c14c646d2b6b943716e0522e
This commit is contained in:
Kunal Mehta 2015-06-07 17:30:00 -07:00
parent 10cd92a326
commit 0919b01e75
2 changed files with 5 additions and 7 deletions

View file

@ -3,8 +3,7 @@
'use strict';
// backwards compatibility <= MW 1.21
var getUrl = mw.util.getUrl || mw.util.wikiGetlink,
useLang = mw.config.get( 'wgUserLanguage' );
var getUrl = mw.util.getUrl || mw.util.wikiGetlink;
function EchoOverlay( apiResultNotifications ) {
this.api = mw.echo.overlay.api;
@ -87,7 +86,7 @@
data = {
action: 'echomarkread',
token: mw.user.tokens.get( 'editToken' ),
uselang: useLang
uselang: 'user'
};
if ( id ) {
// If id is given mark that as read otherwise use all unread messages
@ -469,7 +468,7 @@
notformat: 'flyout',
notlimit: this.notificationLimit,
notprop: 'index|list|count',
uselang: useLang
uselang: 'user'
};
return this.api.get( apiData ).then( function ( result ) {

View file

@ -1,6 +1,5 @@
( function ( $, mw ) {
'use strict';
var useLang = mw.config.get( 'wgUserLanguage' );
mw.echo.special = {
@ -71,7 +70,7 @@
notprop: 'index|list',
notcontinue: this.notcontinue,
notlimit: mw.config.get( 'wgEchoDisplayNum' ),
uselang: useLang
uselang: 'user'
};
api.get( apiData ).done( function ( result ) {
@ -138,7 +137,7 @@
action: 'echomarkread',
list: unread.join( '|' ),
token: mw.user.tokens.get( 'editToken' ),
uselang: useLang
uselang: 'user'
} ).done( function ( result ) {
// update the badge if the link is enabled
if ( result.query.echomarkread.count !== undefined &&