mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 16:14:02 +00:00
filter: Do not set anchor as first_unread
for starred messages view.
Fixes https://chat.zulip.org/#narrow/channel/9-issues/topic/Starred.20messages.20view.20performance/near/2184251. Anchor for starred messages was `first_unread` and the query to find first_unread in a user's starred messages can turn out to be expensive. This commit ensures that we default to newest instead since first_unread is not of important for the starred messages view. By excluding starred messages from using `first_unread`, it will default to newest based on the logic in message_view.ts.
This commit is contained in:
committed by
Tim Abbott
parent
6a1d231689
commit
3dc54a10d7
@@ -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 {
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user