Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
alert_words events: Use AlertWordsEvent pydantic type.
Evy Kassirerb3be7a2d9538
diff --git a/zerver/actions/alert_words.py b/zerver/actions/alert_words.pyindex b88ab5df971..ec6e64c905f 100644--- a/zerver/actions/alert_words.py+++ b/zerver/actions/alert_words.py@@ -3,12 +3,13 @@ from collections.abc import Iterable, Sequencefrom django.db import transactionfrom zerver.lib.alert_words import add_user_alert_words, remove_user_alert_words+from zerver.lib.event_types import AlertWordsEventfrom zerver.models import UserProfilefrom zerver.tornado.django_api import send_event_on_commitdef notify_alert_words(user_profile: UserProfile, words: Sequence[str]) -> None:- event = dict(type="alert_words", alert_words=words)+ event = AlertWordsEvent(alert_words=list(words))send_event_on_commit(user_profile.realm, event, [user_profile.id])diff --git a/zerver/lib/event_types.py b/zerver/lib/event_types.pyindex 8ab9b636bd4..86abfe94dd5 100644--- a/zerver/lib/event_types.py+++ b/zerver/lib/event_types.py@@ -24,7 +24,7 @@ class BaseEvent(BaseModel):class AlertWordsEvent(BaseEvent):- type: Literal["alert_words"]+ type: Literal["alert_words"] = "alert_words"alert_words: list[str]