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.

narrow: Show historical data when narrowed by channels:web-public.

Pratik Chanda686e599ca6d4
diff --git a/zerver/lib/narrow.py b/zerver/lib/narrow.py
index 309e646de60..be956eccfc6 100644
--- a/zerver/lib/narrow.py
+++ b/zerver/lib/narrow.py
@@ -799,7 +799,7 @@ def ok_to_include_history(
include_history = can_access_stream_history_by_id(user_profile, operand)
elif (
term.operator in channels_operators
- and term.operand == "public"
+ and term.operand in ["public", "web-public"]
and not term.negated
and user_profile.can_access_public_streams()
):
diff --git a/zerver/tests/test_message_fetch.py b/zerver/tests/test_message_fetch.py
index 018913900ec..1a6b602f59b 100644
--- a/zerver/tests/test_message_fetch.py
+++ b/zerver/tests/test_message_fetch.py
@@ -1164,6 +1164,18 @@ class IncludeHistoryTest(ZulipTestCase):
]
self.assertFalse(ok_to_include_history(narrow, user_profile, False))
+ # channels:web-public searches should include history for non-guest members.
+ narrow = [
+ NarrowParameter(operator="channels", operand="web-public"),
+ ]
+ self.assertTrue(ok_to_include_history(narrow, user_profile, False))
+
+ # Negated -channels:web-public searches should not include history.
+ narrow = [
+ NarrowParameter(operator="channels", operand="web-public", negated=True),
+ ]
+ self.assertFalse(ok_to_include_history(narrow, user_profile, False))
+
# Definitely forbid seeing history on private channels.
self.make_stream("private_channel", realm=user_profile.realm, invite_only=True)
subscribed_user_profile = self.example_user("cordelia")