get_subscribers_backend: Use access_stream_by_id.

This commit is contained in:
Tim Abbott 2017-01-29 17:01:53 -08:00
parent 0d980b7cef
commit e57e2ee9f1
2 changed files with 2 additions and 3 deletions

View File

@ -2380,8 +2380,7 @@ class GetSubscribersTest(ZulipTestCase):
# Try to fetch the subscriber list as a non-member.
stream_id = get_stream(stream_name, user_profile.realm).id
result = self.make_subscriber_request(stream_id, email=other_email)
self.assert_json_error(result,
"Unable to retrieve subscribers for invite-only stream")
self.assert_json_error(result, "Invalid stream id")
from zerver.lib.streams import access_stream_by_id, access_stream_by_name
class AccessStreamTest(ZulipTestCase):

View File

@ -407,7 +407,7 @@ def add_subscriptions_backend(request, user_profile,
def get_subscribers_backend(request, user_profile,
stream_id=REQ('stream', converter=to_non_negative_int)):
# type: (HttpRequest, UserProfile, int) -> HttpResponse
stream = get_and_validate_stream_by_id(stream_id, user_profile.realm)
(stream, recipient, sub) = access_stream_by_id(user_profile, stream_id)
subscribers = get_subscriber_emails(stream, user_profile)
return json_success({'subscribers': subscribers})