Allow users to reset skin preferences to default with api action=options
Open, NormalPublic

Description

Api action=options has a documented feature:

If no value is given (not even an equals sign), the option will be reset to its default value

But the query api.php?action=options&change=skin&token= will give "Validation error for 'skin': ", because HTMLRadioField::validate will return false on the given null value and that false is converted to a empty string. When it will return true, the null is passed to User::setOption and than gets it default value, which is okay.

See Also:

Details

Reference
bz63080
bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz63080.
bzimport added a subscriber: Unknown Object (MLST).

When not passed a value to set the option to, ApiOptions should either skip the validation attempt (relying on $user->setOption to handle null properly) or should fetch the default itself from User::getDefaultOption.

The former seems slightly easier, while the latter seems slightly cleaner. I don't see a whole lot of reason to prefer either way.

Change 123367 had a related patch set uploaded by Konarak:
Handle defaults for api action=options

https://gerrit.wikimedia.org/r/123367

Anomie moved this task from Unsorted to Needs Review on the MediaWiki-API board.Feb 19 2015, 6:37 PM
He7d3r renamed this task from cannot reset skin preferences to default with api action=options to Allow users to reset skin preferences to default with api action=options.Dec 22 2015, 1:24 PM
He7d3r updated the task description. (Show Details)
He7d3r set Security to None.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptDec 22 2015, 1:24 PM
Catrope removed a subscriber: Catrope.Jan 15 2016, 10:46 PM
Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptMay 5 2017, 9:46 PM
Anomie moved this task from Needs Review to In Dev on the MediaWiki-API board.May 5 2017, 9:46 PM