Last modified: 2013-04-22 16:16:39 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T45959, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 43959 - action=options API should allow resetting of chosen preferences (instead of the all-or-nothing approach)
action=options API should allow resetting of chosen preferences (instead of t...
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.21.x
All All
: Normal enhancement (vote)
: ---
Assigned To: Tyler Romeo
:
Depends on: 40124
Blocks:
  Show dependency treegraph
 
Reported: 2013-01-14 13:45 UTC by Bartosz Dziewoński
Modified: 2013-04-22 16:16 UTC (History)
10 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Bartosz Dziewoński 2013-01-14 13:45:04 UTC
action=options API should allow resetting of chosen preferences, instead of the all-or-nothing approach it currently has.

This would be particularly useful for the newly implemented semi-arbitrary userjs- prefs (see bug 40124), as it's not possible to entirely remove them without killing them all, along with "real" preferences.
Comment 1 Brad Jorsch 2013-01-14 15:08:25 UTC
Seems fine to me. Except we can't use the "reset" parameter for this, do you have a suggestion for a parameter name?
Comment 2 Bartosz Dziewoński 2013-01-14 16:45:11 UTC
We could use 'resetkeys' (which would accept pipe-separated keys), and possibly also implement 'resetkinds' (which would accept pipe-separated options kinds, as returned by User::getOptionsKinds).

API versioning would help, so I'm adding Yuri to CC list ;)
Comment 3 Brad Jorsch 2013-01-14 21:23:35 UTC
If we wait for APIv2, we'll probably be waiting a while. ;)

'resetkeys' sounds fine to me. And 'resetkinds', if someone wants it. May as well deprecate plain 'reset' while we're at it.
Comment 4 Tyler Romeo 2013-01-14 21:37:42 UTC
'resetkeys' is unnecessary; it is already implemented. If you pass an option key without a value to ApiOptions, e.g., api.php?change=optionkey|otheroption&token=blah, ApiOptions will interpret the option value to be null, which, when passed to User::setOption, causes the option to be reset to the default value.

All that is needed is 'resetkinds', so that certain groups of options can be reset, e.g., only userjs- options, rather than having to reset all options.
Comment 5 Bartosz Dziewoński 2013-01-14 22:09:05 UTC
(In reply to comment #4)
> 'resetkeys' is unnecessary; it is already implemented. If you pass an option
> key without a value to ApiOptions, e.g.,
> api.php?change=optionkey|otheroption&token=blah, ApiOptions will interpret
> the
> option value to be null, which, when passed to User::setOption, causes the
> option to be reset to the default value.

Oh, that's interesting (and quite counterintuitive and undocumented). Thanks for the info.
Comment 6 Tyler Romeo 2013-01-14 22:15:38 UTC
I'm probably going to implement 'resetkinds' tonight, so I'll also add in a documentation note about resetting individual options.
Comment 7 Tyler Romeo 2013-01-15 01:50:19 UTC
https://gerrit.wikimedia.org/r/43987
Comment 8 Brad Jorsch 2013-01-18 18:43:36 UTC
Merged.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links