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: Fix check for is personal filter.

Aman Agrawale5db6ac557c3
diff --git a/web/src/filter.ts b/web/src/filter.ts
index b407c29af92..5346af34dbb 100644
--- a/web/src/filter.ts
+++ b/web/src/filter.ts
@@ -1487,7 +1487,8 @@ export class Filter {
//
// Such filters should not advertise "channels:public" as it
// will never add additional results.
- return this.has_operand("is", "mentioned") || this.has_operand("is", "starred");
+ // NOTE: Needs to be in sync with `zerver.lib.narrow.ok_to_include_history`.
+ return this.has_operator("is") && !this.has_operand("is", "resolved");
}
can_apply_locally(is_local_echo = false): boolean {
diff --git a/web/tests/filter.test.cjs b/web/tests/filter.test.cjs
index 5dbc0cfe049..59447adb93d 100644
--- a/web/tests/filter.test.cjs
+++ b/web/tests/filter.test.cjs
@@ -292,7 +292,7 @@ test("basics", () => {
assert.ok(filter.supports_collapsing_recipients());
assert.ok(!filter.has_operator("search"));
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.can_show_next_unread_topic_conversation_button());
assert.ok(filter.can_show_next_unread_dm_conversation_button());
diff --git a/zerver/lib/narrow.py b/zerver/lib/narrow.py
index d5f1ec4f3e9..7cbd6f41be6 100644
--- a/zerver/lib/narrow.py
+++ b/zerver/lib/narrow.py
@@ -859,7 +859,8 @@ def ok_to_include_history(
# that's a property on the UserMessage table. There cannot be
# historical messages in these cases anyway.
for term in narrow:
- if term.operator == "is" and term.operand not in {"resolved", "followed"}:
+ # NOTE: Needs to be in sync with `Filter.is_personal_filter`.
+ if term.operator == "is" and term.operand != "resolved":
include_history = False
return include_history