Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

search: Prefer to use Canonical term type.

Aman Agrawalee470b01000b
diff --git a/web/src/filter.ts b/web/src/filter.ts
index e2d0fc8e2b7..e7199b8acff 100644
--- a/web/src/filter.ts
+++ b/web/src/filter.ts
@@ -460,7 +460,7 @@ export class Filter {
return terms;
}
- static convert_term_to_suggestion(term: NarrowTerm): NarrowTermSuggestion {
+ static convert_term_to_suggestion(term: NarrowCanonicalTerm): NarrowTermSuggestion {
return {
operator: term.operator,
operand: term.operand,
diff --git a/web/src/search.ts b/web/src/search.ts
index 368c7e0c686..4d96b609e74 100644
--- a/web/src/search.ts
+++ b/web/src/search.ts
@@ -10,7 +10,7 @@ import * as popovers from "./popovers.ts";
import * as search_pill from "./search_pill.ts";
import type {SearchPillWidget} from "./search_pill.ts";
import * as search_suggestion from "./search_suggestion.ts";
-import type {NarrowTerm} from "./state_data.ts";
+import type {NarrowCanonicalTerm, NarrowTerm} from "./state_data.ts";
import * as util from "./util.ts";
// Exported for unit testing
@@ -47,7 +47,7 @@ type NarrowSearchOptions = {
type OnNarrowSearch = (terms: NarrowTerm[], options: NarrowSearchOptions) => void;
-function full_search_query_in_terms(): NarrowTerm[] | undefined {
+function full_search_query_in_terms(): NarrowCanonicalTerm[] | undefined {
assert(search_pill_widget !== null);
const search_terms = convert_search_text_to_terms();
@@ -100,9 +100,11 @@ function focus_search_input_at_end(): void {
window.getSelection()!.modify("move", "forward", "line");
}
-function convert_search_text_to_terms(shake_pill_if_invalid = true): NarrowTerm[] | undefined {
+function convert_search_text_to_terms(
+ shake_pill_if_invalid = true,
+): NarrowCanonicalTerm[] | undefined {
const text_terms = Filter.parse(get_search_bar_text());
- const narrow_terms: NarrowTerm[] = [];
+ const narrow_terms: NarrowCanonicalTerm[] = [];
for (const term of text_terms) {
const narrow_term = Filter.convert_suggestion_to_term(term);
if (narrow_term === undefined) {