Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
filter: Use has_operand for numeric channel ID comparison.
Tim Abbott666925a40bbc
diff --git a/web/src/filter.ts b/web/src/filter.tsindex a50d4820c45..0496983ea5d 100644--- a/web/src/filter.ts+++ b/web/src/filter.ts@@ -1910,7 +1910,7 @@ export class Filter {// the property that it's possible for their true value to// change as a result of messages being moved into the// channel/topic pair provided in the parameters.- if (this.has_operand_case_insensitive("channel", new_channel_id)) {+ if (this.has_operand("channel", new_channel_id)) {return true;}diff --git a/web/tests/filter.test.cjs b/web/tests/filter.test.cjsindex 4e8433f8e50..1c80c5a925d 100644--- a/web/tests/filter.test.cjs+++ b/web/tests/filter.test.cjs@@ -3159,11 +3159,11 @@ run_test("adjusted_terms_if_moved", ({override}) => {});run_test("can_newly_match_moved_messages", () => {- // Matches stream- let filter = new Filter([{operator: "channel", operand: "general"}]);- assert.deepEqual(filter.can_newly_match_moved_messages("general", "test"), true);- assert.deepEqual(filter.can_newly_match_moved_messages("General", "test"), true);- assert.deepEqual(filter.can_newly_match_moved_messages("random-stream", "test"), false);+ // Matches channel by ID+ const stream_id_str = general_sub.stream_id.toString();+ let filter = new Filter([{operator: "channel", operand: stream_id_str}]);+ assert.deepEqual(filter.can_newly_match_moved_messages(stream_id_str, "test"), true);+ assert.deepEqual(filter.can_newly_match_moved_messages("99999", "test"), false);// Matches topicfilter = new Filter([{operator: "topic", operand: "Test topic"}]);