narrow_operators: Add with operator to filter.is_conversation_view.

This commit updates "filter.is_conversation_view" to be true for
"with" operator. This is important because essentially, the "with"
operator lands you in the same view as the channel-topic narrow
or the "dm" narrow i.e., the last unread message of the narrow.

Hence, the "with" narrow should be handled in a similar way
while determining whether to allow automatically marking
messages as read, or displaying the unread banner, etc.

Fixes #30863
This commit is contained in:
roanster007
2024-07-16 18:14:26 +05:30
committed by Tim Abbott
parent 48216ca151
commit 61f6ec0829
2 changed files with 6 additions and 2 deletions

View File

@@ -1571,7 +1571,11 @@ export class Filter {
is_conversation_view(): boolean { is_conversation_view(): boolean {
const term_type = this.sorted_term_types(); const term_type = this.sorted_term_types();
if (_.isEqual(term_type, ["channel", "topic"]) || _.isEqual(term_type, ["dm"])) { if (
_.isEqual(term_type, ["channel", "topic", "with"]) ||
_.isEqual(term_type, ["channel", "topic"]) ||
_.isEqual(term_type, ["dm"])
) {
return true; return true;
} }
return false; return false;

View File

@@ -412,7 +412,7 @@ test("basics", () => {
assert.ok(filter.includes_full_stream_history()); assert.ok(filter.includes_full_stream_history());
assert.ok(filter.can_apply_locally()); assert.ok(filter.can_apply_locally());
assert.ok(!filter.is_personal_filter()); assert.ok(!filter.is_personal_filter());
assert.ok(!filter.is_conversation_view()); assert.ok(filter.is_conversation_view());
assert.ok(filter.can_bucket_by("channel", "topic", "with")); assert.ok(filter.can_bucket_by("channel", "topic", "with"));
assert.ok(!filter.is_conversation_view_with_near()); assert.ok(!filter.is_conversation_view_with_near());