Page MenuHomePhabricator

Prevent GlobalPreferences from setting preferences for temporary accounts
Closed, ResolvedPublic

Description

Following T335971, it appears the extension is saving preferences for temporary users.
Update the code to treat temporary users like anon users.

As seen in:
includes/ApiGlobalPreferenceOverrides.php

Wherever these do something different based on whether a user is anonymous or registered, they may need updating (including comments).

Notes
To help with searching:

In PHP preferences are saved via UserOptionsManager::saveOptions
In JS preferences are saved via methods defined on options.js: https://gerrit.wikimedia.org/g/mediawiki/core/+/809d4c9a9dd2cff6321cdae7a41e75b6c362cbbd/resources/src/mediawiki.api/options.js
Code Search: https://codesearch.wmcloud.org/deployed/?q=UserOptionsManager
Tests and comments should also be updated.

Event Timeline

@AGueyte: Assuming this task is about the MediaWiki-extensions-GlobalPreferences code project, thus adding that project tag so people can also find this task when searching via projects or looking at workboards. Please set appropriate project tags when possible. Thanks!

@MusikAnimal @Samwilson given that GlobalPreferences are in passive maintenance, and this does not appear to be a bug, should we close this ticket?

This one is important, as it's part of the Temporary accounts project. So it's not a bug now, but it will be eventually, I guess.

I think we can help with implementing this, as it should be quite easy. Generally speaking however, you're right to go by https://meta.wikimedia.org/wiki/Community_Tech/Maintenance as far as prioritization

Gotcha. Is this something that falls under our responsibility, and if so, when would we need to complete it? (ie, when do we anticipate temporary accounts to ship?)

Change 1005566 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/GlobalPreferences@master] Prevent temporary accounts from using global prefs

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

Change 1005566 merged by jenkins-bot:

[mediawiki/extensions/GlobalPreferences@master] Prevent temporary accounts from using global prefs

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

dom_walden subscribed.

As a temporary user, I cannot access either Special:Preferences or Special:GlobalPreferences. Instead, I am taken to the login form.

When I try to set the local via the API, it returns:

{
    "error": {
        "code": "notloggedin",
        "info": "You must be logged in to edit your preferences.",
    ...
}

When I try to set the global preferences via the api (either action=globalpreferences or action=globalpreferenceoverrides):

{
    "error": {
        "code": "notglobalized",
        "info": "Current user is not global.",
    ....
}

Test environment: https://de.wikipedia.beta.wmflabs.org MediaWiki 1.42.0-alpha (0c5ae51) 14:58, 27 February 2024. GlobalPreferences 0.1.2 (694d833) 08:36, 26 February 2024.