From d5c83e02c38b3f1bf58c9156372a6cc01753e4d1 Mon Sep 17 00:00:00 2001 From: Sanchit Sharma Date: Fri, 11 Apr 2025 09:27:48 +0530 Subject: [PATCH] streams: Return archived web-public channels. --- zerver/lib/message.py | 1 - zerver/lib/streams.py | 5 ----- zerver/tests/test_message_edit.py | 8 ++++---- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/zerver/lib/message.py b/zerver/lib/message.py index 1d5d945f06..ab94407b2c 100644 --- a/zerver/lib/message.py +++ b/zerver/lib/message.py @@ -480,7 +480,6 @@ def access_web_public_message( # These should all have been enforced by the code in # get_web_public_streams_queryset assert stream.is_web_public - assert not stream.deactivated assert not stream.invite_only assert stream.history_public_to_subscribers diff --git a/zerver/lib/streams.py b/zerver/lib/streams.py index 724caf1787..cae1d5456d 100644 --- a/zerver/lib/streams.py +++ b/zerver/lib/streams.py @@ -870,11 +870,6 @@ def get_web_public_streams_queryset(realm: Realm) -> QuerySet[Stream]: return Stream.objects.filter( realm=realm, is_web_public=True, - # In theory, nothing conflicts with allowing web-public access - # to deactivated streams. However, we should offer a way to - # review archived streams and adjust their settings before - # allowing that configuration to exist. - deactivated=False, # In theory, is_web_public=True implies invite_only=False and # history_public_to_subscribers=True, but it's safer to include # these in the query. diff --git a/zerver/tests/test_message_edit.py b/zerver/tests/test_message_edit.py index 0c37631f14..aa574dd3b2 100644 --- a/zerver/tests/test_message_edit.py +++ b/zerver/tests/test_message_edit.py @@ -335,12 +335,12 @@ class EditMessageTest(ZulipTestCase): result, "Not logged in: API authentication or user session required", 401 ) - # Verify deactivated streams are rejected. This may change in the future. + # Verify success with deactivated streams. do_deactivate_stream(web_public_stream, acting_user=None) result = self.client_get("/json/messages/" + str(web_public_stream_msg_id)) - self.assert_json_error( - result, "Not logged in: API authentication or user session required", 401 - ) + response_dict = self.assert_json_success(result) + self.assertEqual(response_dict["raw_content"], "web-public message") + self.assertEqual(response_dict["message"]["flags"], ["read"]) def test_fetch_raw_message_stream_wrong_realm(self) -> None: user_profile = self.example_user("hamlet")