Page MenuHomePhabricator

Officially supported custom namespace presets lack support for label messages
Open, Needs TriagePublic

Description

In docs/settings.md the Advanced-Search documentation says it would be possible to add custom namespace presets, and that the label should be the "id of the translation to use to label the preset checkbox", i.e. a message key. But this can't work because the client-side JavaScript doesn't have access to arbitrary messages – only messages we made available as a ResourceLoader dependency.

Reported here: https://www.mediawiki.org/wiki/Topic:Xtfy4xcqffd529ga

Suggested steps:

  • Add a quick fallback that just shows the 'label' => '…' string from the configuration in plain text in case a message with this key doesn't exist. This might already be enough for some 3rd-party wikis.
  • Add a ResourceLoader module that makes the messages from the configuration available, instead of having them hard-coded in extension.json.
  • While we are doing this we might as well turn the current, somewhat manual way the $wgAdvancedSearchNamespacePresets configuration is made available into a proper ResourceLoader module. https://gerrit.wikimedia.org/r/974117 already contains a draft for this.
  • While we are doing this we can as well move the filter that hides disabled presets from the client to the server, potentially saving bandwidth.

Event Timeline

Change 978104 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/AdvancedSearch@master] Show plain text preset label when message doesn't exist

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

Change 978112 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/AdvancedSearch@master] Make it possible to disable individual popup help messages

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

Change 978120 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/AdvancedSearch@master] Various code cleanups related to namespace presets

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

Change 978120 merged by jenkins-bot:

[mediawiki/extensions/AdvancedSearch@master] Various code cleanups related to namespace presets

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

Change 978104 merged by jenkins-bot:

[mediawiki/extensions/AdvancedSearch@master] Show plain text preset label when message doesn't exist

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

Change 978112 merged by jenkins-bot:

[mediawiki/extensions/AdvancedSearch@master] Make it possible to disable individual popup help messages

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