Page MenuHomePhabricator

Default namespaces is what has been defined in user preferences
Closed, ResolvedPublic3 Story Points

Description

Motivation
Users can define a default namespace selection in the currrent namespace search UI. This selection should be used as default namespace selection when using the advanced search, too.

Task
Listen to what the backend gives you as namespaces that should be shown, and show them (equivalent to how the current namespace search box behaves)

Acceptance Criteria

  • When the user goes onto SpecialSearch:Page, their default preferences are shown in the namespaces bar
  • When a user is redirected from a search they submitted in the searchbox in the upper right corner, their default preferences are shown in the namespace par
  • When the search is sent with a different set of namespaces, these ones are used (so a reload does not lead to suddenly changed namespaces)
  • We don't change preferences

Background
The namespace selection can be found in mw.user.options.searchNs + number

Event Timeline

Lea_WMDE created this task.Aug 2 2017, 10:19 AM
Restricted Application added a project: TCB-Team. · View Herald TranscriptAug 2 2017, 10:19 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Lea_WMDE updated the task description. (Show Details)Aug 9 2017, 11:20 AM
Lea_WMDE triaged this task as Normal priority.Aug 9 2017, 12:18 PM
Lea_WMDE updated the task description. (Show Details)
Lea_WMDE set the point value for this task to 3.

This is not only the namespaces selected and saved by the users but also the list of default namespace searched by default.
Currently when the extension is enabled you can encouter a strange behavior that looks like a bug:

  • Enable the AdvancedSearch beta feature
  • On any page
  • Search using the box top right (top left if rtl)
  • you'll see results for multiple namespaces (either user defaults or wiki defaults)
  • hit the search button again (without changing anything)
  • you'll see results for NS_MAIN only
Lea_WMDE updated the task description. (Show Details)Feb 7 2018, 11:58 AM
Lea_WMDE moved this task from Backlog to Tickets ready for pickup on the Advanced-Search board.
Lea_WMDE updated the task description. (Show Details)Feb 7 2018, 2:00 PM
Lea_WMDE removed the point value for this task.Feb 7 2018, 2:03 PM
Lea_WMDE set the point value for this task to 3.Feb 14 2018, 2:44 PM

Remember that some work was already done in https://gerrit.wikimedia.org/r/#/c/410189/

API reference for the browser tests (for setting the namespaces): https://www.mediawiki.org/wiki/API:Options

@Lea_WMDE Question regarding the interaction with the namespace presets.
Imagine

  • I load a the search form with my default namespace selection (say 4 namespaces)
  • check the "all" namespace preset
  • un-check the "all" namespace preset

Which namespace(s) should be selected?

gabriel-wmde removed gabriel-wmde as the assignee of this task.Feb 19 2018, 3:00 PM
gabriel-wmde moved this task from Deploy to Test to Test on the WMDE-Fundraising-Sprint-17 board.

@Lea_WMDE @Pablo-WMDE

Hm, the current UI allows for deselcting all namespaces but when conducting a search it will just select (Main) automatically even when the default is another combiantion of namspaces.

I suggest we do the same. un-checking "all" reverts back to only the main namespace to be selected. Reverting back to default namespaces makes little sense since what un-checking suggests is the removal of everything or in our case as much as possible since at least one namespace needs to be selected.

@Pablo-WMDE I was wrong. I'm not sure what I did last time when trying it out but I just tried it again and when removing all checkmarks and then execute the search it searches in my preselected default namespaces. I'm really sorry about this.

In this case I suggest we stick with the way it is currently done. un-checking "all" should search in the default namespace selection. My only problem with this is that we don't give the user the possibility to visually remove all selected namespaces. Worst case scenario would be if a user has all namespaces selected as default and would then always have to remove them manually one by one. It would make more sense to visually remove them all and when the search is executed search in the default namespaces and add them back to the namespace field. Is this possible?

@Charlie_WMDE @Pablo-WMDE For the MVP let's go with a simple way first. I suggest we go with the current behavior now (i.e. default namespaces) and discuss more complicated things later?

un-checking "all" should search in the default namespace selection.

This would require for a change. Currently advancedsearch effectively does not allow you to remove all namespaces. The unchecking of the "all" preset tries that, but there is a dedicated logic in place (SearchModel.prototype.setNamespaces) that ensures that when no namespace would be selected, at least one - "MAIN_NAMESPACE" - is indeed selected. This is also played back to the user via UI. Consequently, when submitting from that state, the fallback to the user-specific default namespaces (which seems to be based on "no namespaces were search in") never happens, and the search is performed inside "MAIN_NAMESPACE" only.
To arrive at the described state and be consistent UI-wise, when un-checking the "all" namespace list should be updated to the list of default namespaces - but not sure if this is intuitive...

/cc @Lea_WMDE @Charlie_WMDE

Follow-up (after discussion with @Lea_WMDE) in T187911

@Lea_WMDE for the MVP I'm fine with working with what we have. I will note this down so we don't forget in a future discussion since I think this will need some more thought.

Lea_WMDE closed this task as Resolved.Mar 23 2018, 12:18 PM