From 1ced8d3eb6ecd178b12b0a804f1e792ea188fd2e Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Sun, 29 Jan 2017 16:54:46 -0800 Subject: [PATCH] get_topics_backend: Use access_stream_by_id. --- zerver/views/streams.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/zerver/views/streams.py b/zerver/views/streams.py index a09a5e7df4..43d0cea80e 100644 --- a/zerver/views/streams.py +++ b/zerver/views/streams.py @@ -432,17 +432,7 @@ def get_streams_backend(request, user_profile, def get_topics_backend(request, user_profile, stream_id=REQ(converter=to_non_negative_int)): # type: (HttpRequest, UserProfile, int) -> HttpResponse - stream = get_and_validate_stream_by_id(stream_id, user_profile.realm) - - if stream.realm_id != user_profile.realm_id: - return json_error(_("Invalid stream id")) - - recipient = get_recipient(Recipient.STREAM, stream.id) - - if not stream.is_public(): - if not is_active_subscriber(user_profile=user_profile, - recipient=recipient): - return json_error(_("Invalid stream id")) + (stream, recipient, sub) = access_stream_by_id(user_profile, stream_id) result = get_topic_history_for_stream( user_profile=user_profile,