Merge pull request #2074 from Haokun-Chen/1881

fixed job details search bar when empty input or duplicate input
This commit is contained in:
Jake McDermott
2018-06-06 15:20:55 -04:00
committed by GitHub

View File

@@ -64,9 +64,21 @@ function removeSearchTag (index) {
}
function submitSearch () {
// empty input, not submit new search, return.
if (!vm.value) {
return;
}
const currentQueryset = getCurrentQueryset();
// check duplicate , see if search input already exists in current search tags
if (currentQueryset.search) {
if (currentQueryset.search.includes(vm.value)) {
return;
}
}
const searchInputQueryset = qs.getSearchInputQueryset(vm.value, isFilterable);
const modifiedQueryset = qs.mergeQueryset(currentQueryset, searchInputQueryset);
reloadQueryset(modifiedQueryset, strings.get('search.REJECT_INVALID'));