Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
realm: Allow setting notification settings to unsubscribed private streams.
Sahil Batrab1d5cd6bf62c
diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.pyindex 5c8a321fda7..cea89251a4a 100644--- a/zerver/tests/test_realm.py+++ b/zerver/tests/test_realm.py@@ -494,6 +494,15 @@ class RealmTest(ZulipTestCase):assert realm.notifications_stream is not Noneself.assertEqual(realm.notifications_stream.id, new_notif_stream_id)+ # Test that admin can set the setting to an unsubscribed private stream as well.+ new_notif_stream_id = self.make_stream("private_stream", invite_only=True).id+ req = dict(notifications_stream_id=orjson.dumps(new_notif_stream_id).decode())+ result = self.client_patch("/json/realm", req)+ self.assert_json_success(result)+ realm = get_realm("zulip")+ assert realm.notifications_stream is not None+ self.assertEqual(realm.notifications_stream.id, new_notif_stream_id)+invalid_notif_stream_id = 1234req = dict(notifications_stream_id=orjson.dumps(invalid_notif_stream_id).decode())result = self.client_patch("/json/realm", req)@@ -563,6 +572,18 @@ class RealmTest(ZulipTestCase):assert realm.signup_notifications_stream is not Noneself.assertEqual(realm.signup_notifications_stream.id, new_signup_notifications_stream_id)+ # Test that admin can set the setting to an unsubscribed private stream as well.+ new_signup_notifications_stream_id = self.make_stream("private_stream", invite_only=True).id+ req = dict(+ signup_notifications_stream_id=orjson.dumps(new_signup_notifications_stream_id).decode()+ )++ result = self.client_patch("/json/realm", req)+ self.assert_json_success(result)+ realm = get_realm("zulip")+ assert realm.signup_notifications_stream is not None+ self.assertEqual(realm.signup_notifications_stream.id, new_signup_notifications_stream_id)+invalid_signup_notifications_stream_id = 1234req = dict(signup_notifications_stream_id=orjson.dumps(diff --git a/zerver/views/realm.py b/zerver/views/realm.pyindex 8707c9f78e8..419a7cd9c50 100644--- a/zerver/views/realm.py+++ b/zerver/views/realm.py@@ -383,7 +383,7 @@ def update_realm(new_notifications_stream = Noneif notifications_stream_id >= 0:(new_notifications_stream, sub) = access_stream_by_id(- user_profile, notifications_stream_id+ user_profile, notifications_stream_id, allow_realm_admin=True)do_set_realm_notifications_stream(realm, new_notifications_stream, notifications_stream_id, acting_user=user_profile@@ -397,7 +397,7 @@ def update_realm(new_signup_notifications_stream = Noneif signup_notifications_stream_id >= 0:(new_signup_notifications_stream, sub) = access_stream_by_id(- user_profile, signup_notifications_stream_id+ user_profile, signup_notifications_stream_id, allow_realm_admin=True)do_set_realm_signup_notifications_stream(realm,