From 0f19fda61007caab331d002a273a2671569a413f Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 18 Jul 2025 16:09:27 -0700 Subject: [PATCH] filter: Mark messages as read in -is:dm view. We avoid doing the more complex composability here, since that's potentially risky. Fixes #25113. --- web/src/filter.ts | 4 ++++ web/tests/filter.test.cjs | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/web/src/filter.ts b/web/src/filter.ts index e0320d170d..f22bccf0b9 100644 --- a/web/src/filter.ts +++ b/web/src/filter.ts @@ -1204,6 +1204,10 @@ export class Filter { return true; } + if (_.isEqual(term_types, ["not-is-dm"])) { + return true; + } + if (_.isEqual(term_types, ["is-resolved"])) { return true; } diff --git a/web/tests/filter.test.cjs b/web/tests/filter.test.cjs index bb49024ac1..1da45b095c 100644 --- a/web/tests/filter.test.cjs +++ b/web/tests/filter.test.cjs @@ -347,6 +347,21 @@ test("basics", () => { assert.ok(filter.can_show_next_unread_dm_conversation_button()); assert.ok(!filter.has_exactly_channel_topic_operators()); + terms = [{operator: "is", operand: "dm", negated: true}]; + filter = new Filter(terms); + assert.ok(!filter.contains_only_private_messages()); + assert.ok(filter.can_mark_messages_read()); + assert.ok(filter.contains_no_partial_conversations()); + assert.ok(!filter.has_operator("search")); + assert.ok(filter.can_apply_locally()); + assert.ok(!filter.is_personal_filter()); + assert.ok(!filter.is_conversation_view()); + assert.ok(!filter.is_channel_view()); + assert.ok(filter.may_contain_multiple_conversations()); + assert.ok(!filter.can_show_next_unread_topic_conversation_button()); + assert.ok(!filter.can_show_next_unread_dm_conversation_button()); + assert.ok(!filter.has_exactly_channel_topic_operators()); + // "is:private" was renamed to "is:dm" terms = [{operator: "is", operand: "private"}]; filter = new Filter(terms);