Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

filter: Do not set anchor as `first_unread` for starred messages view.

Shubham Padia3dc54a10d7cb
diff --git a/web/src/filter.ts b/web/src/filter.ts
index 7926be91190..2e36c725473 100644
--- a/web/src/filter.ts
+++ b/web/src/filter.ts
@@ -1547,7 +1547,10 @@ export class Filter {
}
allow_use_first_unread_when_narrowing(): boolean {
- return this.can_mark_messages_read() || this.has_operator("is");
+ return (
+ this.can_mark_messages_read() ||
+ (this.has_operator("is") && !this.has_operand("is", "starred"))
+ );
}
contains_only_private_messages(): boolean {
diff --git a/web/tests/filter.test.cjs b/web/tests/filter.test.cjs
index 4ff9c2aa230..94eaa5f273e 100644
--- a/web/tests/filter.test.cjs
+++ b/web/tests/filter.test.cjs
@@ -834,6 +834,10 @@ test("show_first_unread", () => {
assert.ok(filter.can_mark_messages_read());
assert.ok(filter.allow_use_first_unread_when_narrowing());
+ terms = [{operator: "is", operand: "starred"}];
+ filter = new Filter(terms);
+ assert.ok(!filter.allow_use_first_unread_when_narrowing());
+
// Side case
terms = [{operator: "is", operand: "any"}];
filter = new Filter(terms);