Use mw.Api.plugin.options to set user options
This requires MediaWiki version 1.25+. Change-Id: I3a76b0b4ec403b3acdc29e64b0c750a3b57e252a
This commit is contained in:
committed by
[[mw:User:Fomafix]]
parent
c329f1473d
commit
cd58ac2f18
@@ -82,12 +82,7 @@
|
||||
}
|
||||
|
||||
api = new mw.Api();
|
||||
// @todo Change this to api.saveOption when ULS minimum MW version is 1.25
|
||||
api.postWithToken( 'options', {
|
||||
action: 'options',
|
||||
optionname: 'language',
|
||||
optionvalue: language
|
||||
} )
|
||||
api.saveOption( 'language', language )
|
||||
.done( function () {
|
||||
location.reload();
|
||||
} )
|
||||
|
||||
@@ -149,11 +149,10 @@
|
||||
callback.call( this, true );
|
||||
} else {
|
||||
// Logged in user. Use MW APIs to change preferences
|
||||
new mw.Api().postWithToken( 'options', {
|
||||
action: 'options',
|
||||
optionname: ulsPreferences.preferenceName,
|
||||
optionvalue: JSON.stringify( ulsPreferences.preferences )
|
||||
} ).done( function () {
|
||||
new mw.Api().saveOption(
|
||||
ulsPreferences.preferenceName,
|
||||
JSON.stringify( ulsPreferences.preferences )
|
||||
).done( function () {
|
||||
callback.call( this, true );
|
||||
} ).fail( function () {
|
||||
callback.call( this, false );
|
||||
|
||||
Reference in New Issue
Block a user