Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
streams: Use standard error message when requiring owner.
Tim Abbott71b8a1794ab3
diff --git a/zerver/lib/streams.py b/zerver/lib/streams.pyindex a86c1f09e9d..b4a89d5faf8 100644--- a/zerver/lib/streams.py+++ b/zerver/lib/streams.py@@ -5,7 +5,11 @@ from django.utils.timezone import now as timezone_nowfrom django.utils.translation import gettext as _from typing_extensions import TypedDict-from zerver.lib.exceptions import JsonableError, StreamAdministratorRequired+from zerver.lib.exceptions import (+ JsonableError,+ OrganizationOwnerRequired,+ StreamAdministratorRequired,+)from zerver.lib.markdown import markdown_convertfrom zerver.lib.stream_subscription import get_active_subscriptions_for_stream_idfrom zerver.models import (@@ -669,7 +673,8 @@ def list_to_streams()elif message_retention_days_not_none:if not user_profile.is_realm_owner:- raise JsonableError(_("User cannot create stream with this settings."))+ raise OrganizationOwnerRequired()+user_profile.realm.ensure_not_on_limited_plan()# We already filtered out existing streams, so dup_streamsdiff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.pyindex d907184aa13..3754f1953c7 100644--- a/zerver/tests/test_subs.py+++ b/zerver/tests/test_subs.py@@ -1291,7 +1291,7 @@ class StreamAdminTest(ZulipTestCase):"message_retention_days": 10,}]- with self.assertRaisesRegex(JsonableError, "User cannot create stream with this settings."):+ with self.assertRaisesRegex(JsonableError, "Must be an organization owner"):list_to_streams(streams_raw, admin, autocreate=True)streams_raw = [@@ -1300,7 +1300,7 @@ class StreamAdminTest(ZulipTestCase):"message_retention_days": -1,}]- with self.assertRaisesRegex(JsonableError, "User cannot create stream with this settings."):+ with self.assertRaisesRegex(JsonableError, "Must be an organization owner"):list_to_streams(streams_raw, admin, autocreate=True)streams_raw = [