Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
search: Fix `-in:home` muting logic.
opmkumar4becea399392
diff --git a/web/src/filter.ts b/web/src/filter.tsindex 4361a680ffb..7180106c5d5 100644--- a/web/src/filter.ts+++ b/web/src/filter.ts@@ -120,16 +120,15 @@ function zephyr_topic_name_match(message: Message & {type: "stream"}, operand: sfunction message_in_home(message: Message): boolean {// The home view contains messages not sent to muted channels,- // with additional logic for unmuted topics, mentions, and+ // with additional logic for unmuted topics and// single-channel windows.if (message.type === "private") {return true;}const stream_name = stream_data.get_stream_name_from_id(message.stream_id);if (- message.mentioned ||- (page_params.narrow_stream !== undefined &&- stream_name.toLowerCase() === page_params.narrow_stream.toLowerCase())+ page_params.narrow_stream !== undefined &&+ stream_name.toLowerCase() === page_params.narrow_stream.toLowerCase()) {return true;}@@ -1763,7 +1762,9 @@ export class Filter {// not narrowed to dms!(this.has_operator("dm") || this.has_operand("is", "dm")) &&// not narrowed to starred messages- !this.has_operand("is", "starred")+ !this.has_operand("is", "starred") &&+ // not narrowed to negated home messages+ !this.has_negated_operand("in", "home"));}diff --git a/web/tests/filter.test.cjs b/web/tests/filter.test.cjsindex bb8890dfd4c..39b0996d280 100644--- a/web/tests/filter.test.cjs+++ b/web/tests/filter.test.cjs@@ -2699,6 +2699,26 @@ run_test("is_in_home", () => {assert.ok(!filter3.is_in_home());});+run_test("excludes_muted_topics", () => {+ let filter = new Filter([{operator: "is", operand: "starred"}]);+ assert.ok(!filter.excludes_muted_topics());++ filter = new Filter([{operator: "in", operand: "home", negated: true}]);+ assert.ok(!filter.excludes_muted_topics());++ filter = new Filter([{operator: "search", operand: "pizza"}]);+ assert.ok(!filter.excludes_muted_topics());++ filter = new Filter([+ {operator: "channel", operand: foo_stream_id.toString()},+ {operator: "topic", operand: "bar"},+ ]);+ assert.ok(!filter.excludes_muted_topics());++ filter = new Filter([{operator: "is", operand: "dm"}]);+ assert.ok(!filter.excludes_muted_topics());+});+run_test("equals", () => {let terms = [{operator: "channel", operand: foo_stream_id.toString()}];let filter = new Filter(terms);