Skip to content
Snippets Groups Projects
Unverified Commit c6b5b74a authored by Michael Große's avatar Michael Große
Browse files

fix(search): detect irregular fragment query

If the entered query does not cleanly fall into the area of the given
options, show the current behavior as "custom".
parent df977249
No related branches found
No related tags found
No related merge requests found
......@@ -235,12 +235,17 @@ class Search extends Ui
];
// detect current
$activeOption = 'exact';
$activeOption = 'custom';
foreach ($options as $key => $option) {
if ($this->parsedQuery['and'] === $option['and']) {
$activeOption = $key;
}
}
if ($activeOption === 'custom') {
$options = array_merge(['custom' => [
'label' => $lang['search_custom_match'],
]], $options);
}
$searchForm->addTagOpen('div')->addClass('search-tool js-search-tool');
// render current
......
......@@ -75,6 +75,7 @@ $lang['search_exact_match'] = 'Exact match';
$lang['search_starts_with'] = 'Starts with';
$lang['search_ends_with'] = 'Ends with';
$lang['search_contains'] = 'Contains';
$lang['search_custom_match'] = 'Custom';
$lang['search_any_ns'] = 'Any namespace';
$lang['search_any_time'] = 'Any time';
$lang['search_past_7_days'] = 'Past week';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment