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)
|
"privstream", subscribed=False, invite_only=True)
|
||||||
|
|
||||||
result = self.client_delete('/json/streams/' + str(priv_stream.id))
|
result = self.client_delete('/json/streams/' + str(priv_stream.id))
|
||||||
self.assert_json_error(
|
self.assert_json_error(result, "Invalid stream id")
|
||||||
result, "Cannot administer invite-only streams this way")
|
|
||||||
|
|
||||||
def attempt_unsubscribe_of_principal(self, is_admin=False, is_subbed=True,
|
def attempt_unsubscribe_of_principal(self, is_admin=False, is_subbed=True,
|
||||||
invite_only=False, other_user_subbed=True):
|
invite_only=False, other_user_subbed=True):
|
||||||
|
|
|
@ -135,12 +135,8 @@ def principal_to_user_profile(agent, principal):
|
||||||
@require_realm_admin
|
@require_realm_admin
|
||||||
def deactivate_stream_backend(request, user_profile, stream_id):
|
def deactivate_stream_backend(request, user_profile, stream_id):
|
||||||
# type: (HttpRequest, UserProfile, int) -> HttpResponse
|
# type: (HttpRequest, UserProfile, int) -> HttpResponse
|
||||||
target = get_and_validate_stream_by_id(stream_id, user_profile.realm)
|
(stream, recipient, sub) = access_stream_by_id(user_profile, stream_id)
|
||||||
|
do_deactivate_stream(stream)
|
||||||
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)
|
|
||||||
return json_success()
|
return json_success()
|
||||||
|
|
||||||
@require_realm_admin
|
@require_realm_admin
|
||||||
|
|
Loading…
Reference in New Issue