(bug 41763) Add a hook for support uls-preferences
Change-Id: I8fdc1a0527c9a99b6e5eb95c183955a162233b1d
This commit is contained in:
@@ -68,7 +68,9 @@
|
||||
* @param callback
|
||||
*/
|
||||
save: function ( callback ) {
|
||||
var that = this, api;
|
||||
var ulsPreferences = this,
|
||||
api;
|
||||
|
||||
callback = callback || $.noop;
|
||||
if ( this.isAnon ) {
|
||||
// Anonymous user- Save preferences in local storage
|
||||
@@ -77,20 +79,21 @@
|
||||
} else {
|
||||
// Logged in user. Use MW apis to change preferences
|
||||
api = new mw.Api();
|
||||
|
||||
api.post( {
|
||||
action: 'tokens',
|
||||
type: 'options'
|
||||
} ).done( function ( tokenresult ) {
|
||||
var token = tokenresult.tokens.optionstoken;
|
||||
|
||||
api.post( {
|
||||
action: 'options',
|
||||
change: 'hideminor=1',
|
||||
optionname: that.preferenceName,
|
||||
optionvalue: $.toJSON( that.preferences ),
|
||||
optionname: ulsPreferences.preferenceName,
|
||||
optionvalue: $.toJSON( ulsPreferences.preferences ),
|
||||
token: token
|
||||
} ).done( function () {
|
||||
} ).done( function ( data ) {
|
||||
callback.call( this, true );
|
||||
} ).fail( function () {
|
||||
} ).fail( function ( data ) {
|
||||
callback.call( this, false );
|
||||
} );
|
||||
} ).fail( function () {
|
||||
|
||||
Reference in New Issue
Block a user