diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py index 020c4bce71..e31d2d61f0 100644 --- a/zerver/tests/test_subs.py +++ b/zerver/tests/test_subs.py @@ -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): diff --git a/zerver/views/streams.py b/zerver/views/streams.py index 8bd91701a6..6abebdee93 100644 --- a/zerver/views/streams.py +++ b/zerver/views/streams.py @@ -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})