mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: never perform searches that bypass validation
we must perform another isValidSearchTerm check when we are about to perform search cause the call is debounced
This commit is contained in:
parent
d25dc126f7
commit
a5b0445e02
1 changed files with 14 additions and 7 deletions
|
@ -34,15 +34,22 @@ const SearchHelper = {
|
||||||
const searchContext = contextEnabled ? widget.searchContext() : null;
|
const searchContext = contextEnabled ? widget.searchContext() : null;
|
||||||
const fullSearchUrl = widget.fullSearchUrl();
|
const fullSearchUrl = widget.fullSearchUrl();
|
||||||
|
|
||||||
this._activeSearch = searchForTerm(term, { typeFilter, searchContext, fullSearchUrl });
|
if (!isValidSearchTerm(term)) {
|
||||||
this._activeSearch.then(content => {
|
state.noResults = true;
|
||||||
state.noResults = content.resultTypes.length === 0;
|
state.results = [];
|
||||||
state.results = content;
|
|
||||||
}).finally(() => {
|
|
||||||
state.loading = false;
|
state.loading = false;
|
||||||
widget.scheduleRerender();
|
widget.scheduleRerender();
|
||||||
this._activeSearch = null;
|
} else {
|
||||||
});
|
this._activeSearch = searchForTerm(term, { typeFilter, searchContext, fullSearchUrl });
|
||||||
|
this._activeSearch.then(content => {
|
||||||
|
state.noResults = content.resultTypes.length === 0;
|
||||||
|
state.results = content;
|
||||||
|
}).finally(() => {
|
||||||
|
state.loading = false;
|
||||||
|
widget.scheduleRerender();
|
||||||
|
this._activeSearch = null;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue