From 1afc0496caef7ccde35fd9e012d239a5058d2d27 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Tue, 27 Apr 2021 21:34:40 -0700 Subject: [PATCH] event_schema: Fix translation of typing events message_type. This was incorrectly/lazily marked as a string, not as an enum of two string values, in the previous commit. --- zerver/lib/event_schema.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.py index b1ccc82971..d9eb8ea6e4 100644 --- a/zerver/lib/event_schema.py +++ b/zerver/lib/event_schema.py @@ -1315,11 +1315,18 @@ typing_person_type = DictType( ] ) +equals_private_or_stream = EnumType( + [ + "private", + "stream", + ] +) + typing_start_event = event_dict_type( required_keys=[ ("type", Equals("typing")), ("op", Equals("start")), - ("message_type", str), + ("message_type", equals_private_or_stream), ("sender", typing_person_type), ], optional_keys=[ @@ -1334,7 +1341,7 @@ typing_stop_event = event_dict_type( required_keys=[ ("type", Equals("typing")), ("op", Equals("stop")), - ("message_type", str), + ("message_type", equals_private_or_stream), ("sender", typing_person_type), ], optional_keys=[