Page MenuHomePhabricator

Preferences are saved as GlobalPreferences when autoglobal is enabled for the field
Closed, ResolvedPublicBUG REPORT

Description

Background

Based on the T224245: Create a way to save preference options wherever they are set by GlobalPreferences without disruption we decided that if a preference is local for the user (the user does not have that preference enabled in Special:GlobalPreferences) then the value will be saved locally.

Here's what I thought we agreed to (correct me if I'm wrong) --

If the setting is whitelisted (in however manner we do that, based on your first bulletpoint) GlobalPreferences will check and act according to:

  • If, for the user, the setting is not global -> save in local
  • If, for the user, the setting is global -> save in global
  • If, for the user, the setting is global *but* uses local override -> save in local override.

Basically, GlobalPreferences knows where the setting is actually active for the user, and wherever it is active, it will save it to.

But that is not what happens right now.

Steps to reproduce
  1. Enable autoglobal for the setting and other relevant flags
	$wgGlobalPreferencesAutoPrefs = [
		'email-blacklist',
	];
        $wgEnableUserEmailBlacklist = true;
        $wgEnableSpecialMute = true;
  1. Make sure you don't have Prohibit these users from emailing me as a global preference.
  2. Go to Special:Mute/some-user (Make sure your user has a confirmed email address)
  3. Mute user from sending you emails

Expected behavior: Option is saved locally.
Actual behavior: GlobalPreferences auto-enables Prohibit these users from emailing me

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Niharika changed the subtype of this task from "Task" to "Bug Report".

@MaxSem @Mooeypoo @ifried Flagging this for you all.
For context, @ifried, this task is a bug from T224245: Create a way to save preference options wherever they are set by GlobalPreferences without disruption that Max worked on. It's for an extension that CommTech worked on last year. This bug is a blocker for one of Anti-Harassment-Team tools team's ongoing projects so I'm hoping we can get it fix soon.

Change 563590 had a related patch set uploaded (by Dmaza; owner: Dmaza):
[mediawiki/extensions/GlobalPreferences@master] Fix preferences in $wgGlobalPreferencesAutoPrefs always saving as global

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

Change 563590 merged by jenkins-bot:
[mediawiki/extensions/GlobalPreferences@master] Fix preferences in $wgGlobalPreferencesAutoPrefs always saving as global

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

dom_walden subscribed.

If, for the user, the setting is not global -> save in local
If, for the user, the setting is global -> save in global
If, for the user, the setting is global *but* uses local override -> save in local override.

Repeated these three use cases for option email-blacklist (which is in $wgGlobalPreferencesAutoPrefs) and requireemail (which is not).

For email-blacklist, I tested setting the option from Special:Mute and via the API. For requireemail, just via the API.

In the database I looked at the values of those options in enwiki.user_properties (where local properties are stored) and centralauth.global_preferences (where global properties are stored).

I compared the values of local and global before and after setting the option to see if the behaviour is correct.

Where both global and local values are set, global takes precedence (unless there is a local override). Where there is no global value in the database, there is no global preference for that option.

#$wgGlobalPreferencesAutoPrefsGlobalLocal overrideOutcome
1YesYesNoLocal and global are set to same the value
2YesYesYesLocal value changed; Global value not changed
3YesNoN/ALocal value changed; no global value in DB
4NoYesNoLocal value changed; Global value not changed
5NoYesYesLocal value changed; Global value not changed
6NoNoN/ALocal value changed; no global value in DB

The difference is in row 3. Now, when the option is set locally it does not save the option as a global preference.

Testing Environment: https://en.wikipedia.beta.wmflabs.org