search: Fix user settings overwriting search parameters from URL
Created by: fkling
Fixes: #33435 (closed)
The logic to load search parameters from user settings only accounted for search parameters passed as actual URL parameters, not as part of the search query.
This PR changes the approach and moves the responsibility of correctly applying the settings from the user settings loading code to the query state store.
I'm also removing the default values from the settings helper methods since I'm not a fan of sprinkling the default values across the code base and it aligns better with my expectations for these functions (no settings, not value). But I'm OK adding it back if we want those functions to always return a valid value.
Test plan
New unit tests.
- Navigated to https://sourcegraph.test:3443/search and verified that
regexp
is selected as configured in my user settings. - Navigated to https://sourcegraph.test:3443/search?q=context:global+test+patternType:structural and verified that structural search is selected (i.e. overwriting my user settings).