Page MenuHomePhabricator

Add namespace filter values to URL params and use them in the PHP UI
Closed, ResolvedPublic

Description

The namespace filter will be built as part of T276261 but will only function in the JavaScript UI. This task covers handling the filter values as we have for other filters: adding the value(s) of this filter to the URL, respecting the value of the filter in the URL in the PHP UI, and showing a read-only version of the filter in the PHP UI.

Acceptance criteria:

  • When a user changes the value of the namespace filter, the value will be added to the URL
  • If All, Discussion, or General Help is selected, a matching keyword will be used as the URL param value
  • If Custom is selected, all of the selected namespaces must be added to the URL (either by key, e.g. NS_TALK, or by numerical ID)
  • The read-only filter will only show the keyword (including "custom") of the selected radio button, not all of the selected namespaces
  • Namespace filter settings (including custom namespace selections) are handled correctly during history navigation, disappearing when the user goes "back" and returning to the proper values when the user goes "forward" again.
  • URL parameters, UI state (checked boxes, radio buttons, etc) remain in sync at all times and always accurately reflect the namespace values being sent to the search API

Event Timeline

If the user provides an invalid namespace as a URL parameter, should we show the same "Invalid Search" message we're using for T273839 and T271387, or should we show something more specific in this case?

If the user provides an invalid namespace as a URL parameter, should we show the same "Invalid Search" message we're using for T273839 and T271387, or should we show something more specific in this case?

Let's show the same "Invalid Search" message we're using for T273839 and T271387 to keep things consistent.

Once the initial JS version of this feature is ready I'll pick up this ticket to handle NS filters in PHP and in URL params / history state.

Change 674437 had a related patch set uploaded (by Eric Gardner; owner: Eric Gardner):
[mediawiki/extensions/WikibaseMediaInfo@master] WIP Support namespace filters in PHP & URL Params

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

Change 674873 had a related patch set uploaded (by Anne Tomasevich; author: Anne Tomasevich):
[mediawiki/extensions/WikibaseMediaInfo@master] [POC] Make JS handling of namespace data match PHP

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

Change 674437 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Support namespace filters in PHP & URL Params

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

Change 674873 merged by jenkins-bot:
[mediawiki/extensions/WikibaseMediaInfo@master] Make JS handling of namespace data match PHP

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

Checked on comons wmf.37 - the screenshots in the table show the difference in UI between invalid parameters for &type=foo and &namespace=foo.
Based on T271387 and this tasks specs, both UI seem acceptable.

&type=foo&namespace=foo
Screen Shot 2021-04-02 at 4.14.14 PM.png (277×831 px, 36 KB)
Screen Shot 2021-04-02 at 4.13.08 PM.png (538×906 px, 55 KB)