Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
filter: Canonicalize operator before creating parsed term.
evykassirer9dab566d1031
diff --git a/web/src/filter.ts b/web/src/filter.tsindex ffb569879aa..d14b2315ed1 100644--- a/web/src/filter.ts+++ b/web/src/filter.ts@@ -508,7 +508,11 @@ export class Filter {// terms list. This is done so that the last active filter is correctly// detected by the `get_search_result` function (in search_suggestions.ts).maybe_add_search_terms();- term = {negated, operator, operand};+ term = {+ negated,+ operator: Filter.canonicalize_operator(operator),+ operand,+ };terms.push(term);}}diff --git a/web/tests/filter.test.js b/web/tests/filter.test.jsindex e5c56c98ef5..c6578c9ccef 100644--- a/web/tests/filter.test.js+++ b/web/tests/filter.test.js@@ -1242,7 +1242,7 @@ test("parse", () => {// "stream" was renamed to "channel"string = "stream:Foo topic:Bar yo";terms = [- {operator: "stream", operand: "Foo"},+ {operator: "channel", operand: "Foo"},{operator: "topic", operand: "Bar"},{operator: "search", operand: "yo"},];@@ -1313,7 +1313,7 @@ test("parse", () => {// "streams" was renamed to "channels"string = "streams:public";- terms = [{operator: "streams", operand: "public"}];+ terms = [{operator: "channels", operand: "public"}];_test();string = "channel:foo :emoji: are cool";