Page MenuHomePhabricator

Regression: API action=options cannot enable/disable gadgets
Closed, ResolvedPublic

Description

After change I98df55f2 from bug 42202, the API's action=options can no longer change the preferences for which gadgets are enabled, or anything else that uses a "multiselect" HTMLForm element.

The problem is that these multiselect elements are stored in the user preferences table by storing one key with a boolean value for each option in the multiselect, but the validation code added does not take this into account and therefore considers all of these option keys invalid.

Gerrit changeset to be posted shortly.


Version: 1.21.x
Severity: normal

Details

Reference
bz42639

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:12 AM
bzimport set Reference to bz42639.

Here is what before a change was possible:

POST
https://commons.wikimedia.org/w/api.php

action options
format json
optionname gadget-Gallerypreview
optionvalue 1
token XXXXXXXXXXXXXXXXXXXXXXX+\

But the response is now:

{"warnings":{"options":{"*":"Not a valid preference: gadget-Gallerypreview"}},"options":"success"}

At Commons there is a gadget named "Gallerypreview". c.f. https://commons.wikimedia.org/wiki/MediaWiki:Gadgets-definition

The same happens when attempting to disable a gadget:
action options
format json
optionname gadget-Slideshow
optionvalue 0
token XXXXXXXXXXXXXXXXXXXXXXX+\

Is this deployed yet?

Aside from that, it shouldn't return "success"... Nothing is changed because it couldn't find the key so it's an error.

Not yet deployed: this was merged on December 14th, so per the Roadmap[1] didn't make it into wmf6. It did make it into wmf7 AFAIK, which is due to be deployed on Commons today.

[1] https://www.mediawiki.org/wiki/MediaWiki_1.21/Roadmap

(WMF switched for a three-week deployment cycle for wmf6 and wmf7 due to the holidays.)