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

bzimport added a project: MediaWiki-API.Via ConduitNov 22 2014, 1:12 AM
bzimport set Reference to bz42639.
Anomie created this task.Via LegacyDec 3 2012, 3:53 AM
Anomie added a comment.Via ConduitDec 3 2012, 3:55 AM

Gerrit changeset 36494

Anomie added a comment.Via ConduitDec 14 2012, 3:53 PM

Change merged.

Rillke added a comment.Via ConduitJan 7 2013, 12:16 AM

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.

matmarex added a comment.Via ConduitJan 7 2013, 6:08 AM

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.)

Add Comment