Follow-up Ica9e5a9284: Actually make visualeditor-hidebetawelcome work

Three 'minor' points:

* You have to declare even hidden preferences. Whoops.
* There's no such thing as an "optionsToken", use "editToken".
* You need to POST action=options API calls.

Ahem.

Change-Id: I9c4358107af7bcfca157bd014de49882914e990c
This commit is contained in:
James D. Forrester 2014-05-10 21:58:02 +02:00 committed by Jforrester
parent 20b5c4038b
commit 80fc16a57e
2 changed files with 5 additions and 2 deletions

View file

@ -279,6 +279,9 @@ class VisualEditorHooks {
'label-message' => 'visualeditor-preference-betatempdisable',
'section' => 'editing/editor'
);
$preferences['visualeditor-hidebetawelcome'] = array(
'type' => 'api'
);
return true;
}

View file

@ -1580,9 +1580,9 @@ ve.init.mw.ViewPageTarget.prototype.maybeShowDialogs = function () {
if ( prefSaysShow ) {
ve.init.mw.Target.static.apiRequest( {
'action': 'options',
'token': mw.user.tokens.get( 'optionsToken' ),
'token': mw.user.tokens.get( 'editToken' ),
'change': 'visualeditor-hidebetawelcome=1'
} );
}, { 'type': 'POST' } );
// No need to set a cookie every time for logged-in users that have already
// set the hidebetawelcome=1 preference, but only if this isn't a one-off