Page MenuHomePhabricator

"Notify me about these events" ignores global preferences settings, even unable to change via Global Preferences
Open, Needs TriagePublicBUG REPORT

Description

I once checked "Set a local exception for this global preference." in my use preference's "Notify me about these events" section in Chinese Wikipedia. After I set a local exception, I modified my settings, unchecked every checkbox. I then saved my settings.

Today I decided to undo my changes, so I straightforwardly unchecked "Set a local exception for this global preference." and saved my preferences. The global preference does not sync to the settings, and I even cannot set my settings via global preferences.

Event Timeline

Restricted Application added subscribers: Stang, Aklapper. · View Herald Transcript
dom_walden added a subscriber: dom_walden.

Thanks for finding and raising this @MilkyDefer. Sadly I have not been able to find a workaround for this for you. You could clear your global and local settings completely, but this might not be very convenient for you.

This raises some important issues with how GlobalPreferences works with Echo Notifications options.

There seems to me to be at least three things going on here:

One
It appears impossible to clear the local exceptions for all the Echo notification options (the "Notify me about these events" section as mentioned above).

When you uncheck the local exception that appears at the bottom of the section, only echo-subscriptions-local-exception is set to 0. All the others (which refer to specific options, e.g. echo-subscriptions-email-newsletter-local-exception) are still 1.

Two
Possibly as a result of one, it is impossible to clear the local value of Echo notification options. Instead, they mostly seem to get set to 0 in the database.

Three
Special:GlobalPreferences appears to retrieve the current value of user options from the local wiki's user preferences, not global preferences.

So, when @MilkyDefer tries to save a new global value, it does actually get saved to the global_preferences database. However, the Special:GlobalPreferences form still shows the value from the user_properties table. I am unsure whether the global or the local value will be applied, as the local exception may still be set.

Checked on betalabs for Global/Local settings for Notifications. Setting/un-setting Local Notifications options resets Global Notifications options.

Goals:

  • set Global settings for Notifications
  • add a Local exception
  • remove a Local exception

Expectations:

  • as Global settings were set (and saved), they would stay
  • changes in Local settings will not affect Global settings
  • if "Set a local exception for this global preference" option is un-checked, the option(s) with the Local exception would sync with the same Global setting(s).

Actual Workflow

(1) A user goes to Local Notifications and sees the pre-selected options and doesn't change anything.

Screen Shot 2022-01-07 at 6.17.30 PM.png (1×1 px, 189 KB)

(2) After that a user goes to Global Notifications settings and sees them as

  • not enabled
  • the greyed check marks match Local Notifications selected options

Screen Shot 2022-01-07 at 6.22.11 PM.png (1×984 px, 175 KB)

(3) A user enables Global Notifications settings (checking the checkbox "Notify me about these events") - the options are enabled and matched the Local Notifications settings. A user doesn't change anything.
(4) On Local Notifications, a user checks "Set a local exception for this global preference" and changes a Local Notifications settings for Page reminder
Screen Shot 2022-01-07 at 6.31.22 PM.png (1×1 px, 168 KB)

(5) Going back to Global settings, a user sees that all Global settings are changed because of (4) action - all boxes become un-checked :
(6) A user goes to Local settings and un-checks "Set a local exception for this global preference" - the Local settings disappear (or, in this case, got synced with empty Global settings).
Screen Shot 2022-01-07 at 6.36.18 PM.png (1×1 px, 164 KB)

Sorry, this is caused by a mistake I made in a patch for T294675. But, come on, I have created a follow-up patch and added a bunch of reviewers from my last patch after I noticed it last month, and no one come to approve it!

Change 747477 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/GlobalPreferences@master] Fix support for setting local exceptions on CheckMatrix fields

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

Thanks for Majavah kindly approving it!

Change 747477 merged by jenkins-bot:

[mediawiki/extensions/GlobalPreferences@master] Fix support for setting local exceptions on CheckMatrix fields

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

Sorry, this is caused by a mistake I made in a patch for T294675. But, come on, I have created a follow-up patch and added a bunch of reviewers from my last patch after I noticed it last month, and no one come to approve it!

Sorry, we've been on holiday and prepping for the Community Wishlist Survey. I have noticed all the GlobalPrefs patches just haven't gotten a chance to get to them yet. Other engineers on my team hopefully can help but if not we'll see if we can get some outside help. If there's anything deemed urgent, please let us know!

Sorry, we've been on holiday and prepping for the Community Wishlist Survey. I have noticed all the GlobalPrefs patches just haven't gotten a chance to get to them yet. Other engineers on my team hopefully can help but if not we'll see if we can get some outside help. If there's anything deemed urgent, please let us know!

Never mind, this minor bug is fixed and most things will back to order after the next deploy train. By the way, users of 1.37 would be grateful if you can approve my backport for T294675. Though I realized it's not a perfect solution now, something is better than nothing.

Checked on testwiki wmf.17 - the issue seems to be resolved (also checked T294675).

I think I can still reproduce this problem on beta (https://en.wikipedia.beta.wmflabs.org GlobalPreferences 0.1.2 (eb33675) 07:23, 11 January 2022). I want to check my understanding with @Func and @Etonkovidova

What I did:

  1. To start from a clean-slate, I reset both my local and global preferences (Special:Preferences/reset, Special:GlobalPreferences/reset)
  2. On Special:GlobalPreferences, I made Notifications a global preference and saved (I didn't change any default values for the individual settings)
  3. On Special:Preferences, I checked the local override and unchecked all the individual values for the Notification settings and saved
  4. I then unchecked the local override and saved

Outcome:

  • Special:Preferences shows all the Notifications disabled but unchecked
    disabled_unchecked.png (416×510 px, 24 KB)
  • Special:GlobalPreferences shows all the notifications unchecked (but this is not their values in the global_preferences table)
    global_unchecked.png (413×604 px, 25 KB)
  • echo-subscriptions-local-exception is 0 in the user_properties table but all the others referring to individual options (e.g. echo-subscriptions-email-user-rights-local-exception) are 1
  • All the individual Notification options (e.g. echo-subscriptions-web-mention) in the user_properties table are set to 0, rather than being cleared/set to default
  • Attempting to save new values for Notifications in Special:GlobalPreferences does not appear to be effective (i.e. the value does change in the database but is not reflected in the UI)

I tried this on two different browsers, including a browser with a cleared cache, just in case there was some old javascript being cached (although I appreciate this might not actually be a javascript bug).

Change 753627 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/GlobalPreferences@master] Fix support for setting global exceptions on CheckMatrix fields

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

  • Special:GlobalPreferences shows all the notifications unchecked (but this is not their values in the global_preferences table)
  • echo-subscriptions-local-exception is 0 in the user_properties table but all the others referring to individual options (e.g. echo-subscriptions-email-user-rights-local-exception) are 1
  • Attempting to save new values for Notifications in Special:GlobalPreferences does not appear to be effective (i.e. the value does change in the database but is not reflected in the UI)

Confirmed, this is a bug that was introduced in 2018, ref: https://gerrit.wikimedia.org/r/c/440564

  • All the individual Notification options (e.g. echo-subscriptions-web-mention) in the user_properties table are set to 0, rather than being cleared/set to default

I think this can be a feature, in case user canceled their global exception, preferences can fallback to their old local ones.

  • Special:GlobalPreferences shows all the notifications unchecked (but this is not their values in the global_preferences table)
  • echo-subscriptions-local-exception is 0 in the user_properties table but all the others referring to individual options (e.g. echo-subscriptions-email-user-rights-local-exception) are 1
  • Attempting to save new values for Notifications in Special:GlobalPreferences does not appear to be effective (i.e. the value does change in the database but is not reflected in the UI)

Confirmed, this is a bug that was introduced in 2018, ref: https://gerrit.wikimedia.org/r/c/440564

Thanks for the follow up patch. I will move this into Review on our board.

  • All the individual Notification options (e.g. echo-subscriptions-web-mention) in the user_properties table are set to 0, rather than being cleared/set to default

I think this can be a feature, in case user canceled their global exception, preferences can fallback to their old local ones.

Unfortunately, it seems that all the options get set to 0 regardless of what their previous value was (unless their default is 0 in which case they are cleared). So, it does not save the old local values nor returns them to the default state.

Change 753631 had a related patch set uploaded (by Func; author: Func):

[mediawiki/core@master] HTMLForm: Load data from default for fields that are supposed to be disabled

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

Change 753632 had a related patch set uploaded (by Func; author: Func):

[mediawiki/extensions/GlobalPreferences@master] Remove the redundant filter on local exceptions

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

Unfortunately, it seems that all the options get set to 0 regardless of what their previous value was (unless their default is 0 in which case they are cleared). So, it does not save the old local values nor returns them to the default state.

Thank you for your test! Follow-up patches are attached.

Change 753627 merged by jenkins-bot:

[mediawiki/extensions/GlobalPreferences@master] Fix support for setting global exceptions on CheckMatrix fields

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

Change 753631 merged by jenkins-bot:

[mediawiki/core@master] HTMLForm: Load data from default for fields that are supposed to be disabled

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

Change 753632 merged by jenkins-bot:

[mediawiki/extensions/GlobalPreferences@master] Remove the redundant filter on local exceptions

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

matmarex added a subscriber: matmarex.

All patches merged, please verify :) (I'm not sure if I should be moving things on the workboard, I hope you don't mind)

If I have previously set a local exception for the notifications matrix, when I unset the local exception it is correctly unset in the database. Therefore, the user's notification settings should fall-back to whatever they set globally.

notification_local_exception.png (201×449 px, 11 KB)

Once I have unset the local exception, it is then possible to change my global preferences, and have this reflected in the Special:GlobalPreferences form (before, changes were made in the database but were not displaying correctly in the UI).

notification_global_before_after.png (210×1 px, 26 KB)

I believe this fixes the bug described in the description.

N.B. When setting a local exception two things are recorded in the database. The value of the local option and whether the local exception for that option is on or off. In the above case, we turn the local exception off but do not immediately clear the local value for the option (they remain as the user set them). This does not matter as long as the local exception is off as it will ignore the local value. If they unset the global preference then the user's option will return to whatever local value they had set previously, rather than the default.

unsetting_global_pref.png (300×1 px, 38 KB)

If, while the local exception is off, they submit Special:Preferences a second time the local values will be cleared. Unsetting the global preference will then return the user's options to default.

This is a known bug/feature, see T296851.

Test Environment: https://en.wikipedia.beta.wmflabs.org GlobalPreferences 0.1.2 (47cee3d) 07:12, 17 January 2022.