Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
archive: Use access_web_public_stream helper.
Tim Abbott7856098bdb83
diff --git a/zerver/views/archive.py b/zerver/views/archive.pyindex 62a499dc5f8..ed6cd72608c 100644--- a/zerver/views/archive.py+++ b/zerver/views/archive.py@@ -7,7 +7,7 @@ from django.template import loaderfrom zerver.lib.avatar import get_gravatar_urlfrom zerver.lib.exceptions import JsonableErrorfrom zerver.lib.response import json_success-from zerver.lib.streams import get_stream_by_id+from zerver.lib.streams import access_web_public_streamfrom zerver.lib.timestamp import datetime_to_timestampfrom zerver.lib.topic import get_topic_history_for_public_stream, messages_for_topicfrom zerver.models import Message, UserProfile@@ -29,13 +29,10 @@ def archive(request: HttpRequest, stream_id: int, topic_name: str) -> HttpRespon)try:- stream = get_stream_by_id(stream_id)+ stream = access_web_public_stream(stream_id, request.realm)except JsonableError:return get_response([], False, "")- if not stream.is_web_public:- return get_response([], False, "")-all_messages = list(messages_for_topic(stream_recipient_id=stream.recipient_id,@@ -78,13 +75,10 @@ def archive(request: HttpRequest, stream_id: int, topic_name: str) -> HttpRespondef get_web_public_topics_backend(request: HttpRequest, stream_id: int) -> HttpResponse:try:- stream = get_stream_by_id(stream_id)+ stream = access_web_public_stream(stream_id, request.realm)except JsonableError:return json_success(dict(topics=[]))- if not stream.is_web_public:- return json_success(dict(topics=[]))-result = get_topic_history_for_public_stream(recipient_id=stream.recipient_id)return json_success(dict(topics=result))