Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
realm_playgrounds events: Use RealmPlaygroundsEvent pydantic type.
Evy Kassirer9ee6738bccd5
diff --git a/zerver/actions/realm_playgrounds.py b/zerver/actions/realm_playgrounds.pyindex f2d92d84105..addcacdab0f 100644--- a/zerver/actions/realm_playgrounds.py+++ b/zerver/actions/realm_playgrounds.py@@ -2,6 +2,8 @@ from django.core.exceptions import ValidationErrorfrom django.db import transactionfrom django.utils.timezone import now as timezone_now+from zerver.lib.event_types import RealmPlayground as RealmPlaygroundData+from zerver.lib.event_types import RealmPlaygroundsEventfrom zerver.lib.exceptions import ValidationFailureErrorfrom zerver.lib.types import RealmPlaygroundDictfrom zerver.models import Realm, RealmAuditLog, RealmPlayground, UserProfile@@ -12,7 +14,9 @@ from zerver.tornado.django_api import send_event_on_commitdef notify_realm_playgrounds(realm: Realm, realm_playgrounds: list[RealmPlaygroundDict]) -> None:- event = dict(type="realm_playgrounds", realm_playgrounds=realm_playgrounds)+ event = RealmPlaygroundsEvent(+ realm_playgrounds=[RealmPlaygroundData(**p) for p in realm_playgrounds],+ )send_event_on_commit(realm, event, active_user_ids(realm.id))diff --git a/zerver/lib/event_types.py b/zerver/lib/event_types.pyindex 39713de707d..a00fbb69f56 100644--- a/zerver/lib/event_types.py+++ b/zerver/lib/event_types.py@@ -551,7 +551,7 @@ class RealmPlayground(BaseModel):class RealmPlaygroundsEvent(BaseEvent):- type: Literal["realm_playgrounds"]+ type: Literal["realm_playgrounds"] = "realm_playgrounds"realm_playgrounds: list[RealmPlayground]