mirror of https://github.com/zulip/zulip.git
deactivate_stream_backend: Use access_stream_by_id.
This commit is contained in:
parent
826cc80c9e
commit
6685885741
|
@ -485,8 +485,7 @@ class StreamAdminTest(ZulipTestCase):
|
|||
"privstream", subscribed=False, invite_only=True)
|
||||
|
||||
result = self.client_delete('/json/streams/' + str(priv_stream.id))
|
||||
self.assert_json_error(
|
||||
result, "Cannot administer invite-only streams this way")
|
||||
self.assert_json_error(result, "Invalid stream id")
|
||||
|
||||
def attempt_unsubscribe_of_principal(self, is_admin=False, is_subbed=True,
|
||||
invite_only=False, other_user_subbed=True):
|
||||
|
|
|
@ -135,12 +135,8 @@ def principal_to_user_profile(agent, principal):
|
|||
@require_realm_admin
|
||||
def deactivate_stream_backend(request, user_profile, stream_id):
|
||||
# type: (HttpRequest, UserProfile, int) -> HttpResponse
|
||||
target = get_and_validate_stream_by_id(stream_id, user_profile.realm)
|
||||
|
||||
if target.invite_only and not subscribed_to_stream(user_profile, target):
|
||||
return json_error(_('Cannot administer invite-only streams this way'))
|
||||
|
||||
do_deactivate_stream(target)
|
||||
(stream, recipient, sub) = access_stream_by_id(user_profile, stream_id)
|
||||
do_deactivate_stream(stream)
|
||||
return json_success()
|
||||
|
||||
@require_realm_admin
|
||||
|
|
Loading…
Reference in New Issue