Skip to content

armgit / zulip

Public Imported from GitHub
0

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.py
index 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_now
from 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_convert
from zerver.lib.stream_subscription import get_active_subscriptions_for_stream_id
from 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_streams
diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py
index 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 = [