Page MenuHomePhabricator

Unable to set a local override for some Global Preferences
Open, Needs TriagePublic1 Estimated Story PointsBUG REPORT

Description

Some global preferences can not be given local exceptions, even though they appear to in the interface. Examples include "Image size limit on file description pages", "Enable Media Viewer", "Do not show page content below diffs", and seemingly everything beneath the "Time offset" section.

List of steps to reproduce (step by step, including full links if applicable):

  • Go to Special:GlobalPreferences > Appearance and make sure "Enable Media Viewer" is set, and save if necessary.
  • Go to Special:Preferences and select "Set a local exception for this global preference" beneath the "Enable Media Viewer" option.

What happens?:

  • The "Enable Media Viewer" checkbox is disabled

Screenshot from 2021-11-18 16-11-37.png (103Γ—513 px, 12 KB)

What should have happened instead?:

  • The "Enable Media Viewer" should be enabled, allowing me to make a local exception for the global preference.

Software version: MW 1.38.0-wmf.9

Event Timeline

Restricted Application added a subscriber: Aklapper. Β· View Herald Transcript

We can see an error in the console, reads:

Error: Unknown widget type: id: wpTimeCorrection, class: mw.widgets.SelectWithInputWidget
    at Object.OO.ui.Element.static.unsafeInfuse (/w/load.php?lang=zh-cn&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=timeless&version=13mac:151)
    at Object.OO.ui.Element.static.infuse (/w/load.php?lang=zh-cn&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=timeless&version=13mac:150)
    at Object.OO.ui.infuse (/w/load.php?lang=zh-cn&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=timeless&version=13mac:147)
    at updatePrefInput (<anonymous>:61:1306)
    at HTMLSpanElement.<anonymous> (<anonymous>:62:136)
    at Function.each (/w/load.php?lang=zh-cn&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=timeless&version=13mac:5)
    at jQuery.fn.init.each (/w/load.php?lang=zh-cn&modules=jquery%2Coojs-ui-core%2Coojs-ui-widgets&skin=timeless&version=13mac:3)
    at <anonymous>:61:1540
    at <anonymous>:62:208
    at runScript (/w/load.php?lang=zh-cn&modules=startup&only=scripts&raw=1&safemode=1&skin=timeless:12)
logError @ load.php?lang=zh-cn&modules=startup&only=scripts&raw=1&safemode=1&skin=timeless:1

So all the fields under the wpTimeCorrection failed to init.

Change 739964 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/extensions/GlobalPreferences@master] Add missing dependency on mediawiki.widgets.SelectWithInputWidget

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

You can use this javascript snippet on Special:GlobalPreferences to enable every option globally:

$( "input[name*='global']" ).click();

and then run this snippet on Special:Preferences to check every local override checkbox:

$( "input[name*='local-exception']" ).click();

This also occurred when you made the email mute list (wpemail-blacklist) global. Every checkbox after that option does not become enabled correctly.

This patch appears to fix that as well.

Change 739964 merged by jenkins-bot:

[mediawiki/extensions/GlobalPreferences@master] Add missing dependency on mediawiki.widgets.SelectWithInputWidget

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

@Samwilson After making the option "Muted pages for page link notifications" (wpecho-notifications-page-linked-title-muted-list) global, when loading Special:Preferences I get the error:

Error: Unknown widget type: id: mw-input-wpecho-notifications-page-linked-title-muted-list, class: mw.widgets.TitlesMultiselectWidget

This is on beta, reproduced with Safari and Firefox.

On Firefox, I find it leads to a brief hang and a "long running script" warning.

Is this related, or should I raise a separate ticket?

Oh, another similar error... Can we bring https://gerrit.wikimedia.org/r/c/683142 to reality? Or anyone can figure out all the dependencies this script needs?

Is this related, or should I raise a separate ticket?

I have raised T296638.

After making the option "Muted pages for page link notifications" (wpecho-notifications-page-linked-title-muted-list) global, when loading Special:Preferences I get the error…

Frankly I don't know why this preference is global. The use case is you authored a very popular page, say [[The New York Times]]. Lots of other editors link to your page in citations, and eventually you get so many notifications you decide to mute them for that page. The question is how often is it that you have the same problem for the same page title across multiple wikis? Sure, it's possible, but seems like an edge case. But I digress.

Oh, another similar error... Can we bring https://gerrit.wikimedia.org/r/c/683142 to reality? Or anyone can figure out all the dependencies this script needs?

I think there's no question the approach you took there is the more "correct" one, it's just more costly in terms of code review. We haven't forgotten about it, though! :) For now I've gone the easy route with https://gerrit.wikimedia.org/r/742544.

I have raised T296638.

Thanks. Are there any other outstanding issues or is this task good to proceed to product sign-off?

Thanks. Are there any other outstanding issues or is this task good to proceed to product sign-off?

I don't think so.

I've tried setting all my user preferences globally and I can successfully set a local override for them all.

I have done this on a few different wikis, each of which has a slightly different set of user preferences to set. I don't think I have covered all possible user options, because there are too many.

The label text looks like it is still disabled. I don't know if this is an old or new bug. It is only cosmetic. I've raised T296924.

Test environment: various beta, latest https://zh.wikipedia.beta.wmflabs.org MediaWiki 1.38.0-alpha (2682461) 2021-12-02T00:22:01. GlobalPreferences 0.1.2 (e9ea9af) 2021-11-30T22:41:20.

Hey @Samwilson we talked about this one at sprint planning today; do you mind estimating this retroactively? Thank you!

Samwilson set the point value for this task to 1.Dec 2 2021, 10:47 PM