Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
event_types: Allow None for EventRealmUpdate.value.
Anders Kaseorg235ead6247b9
diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.pyindex 76c7ada4c8c..27f33af230e 100644--- a/zerver/lib/event_schema.py+++ b/zerver/lib/event_schema.py@@ -418,15 +418,7 @@ def check_realm_update(returnproperty_type = Realm.property_types[prop]-- if property_type in (bool, int, str):- assert isinstance(value, property_type)- elif property_type == (int, type(None)):- assert isinstance(value, int)- elif property_type == (str, type(None)):- assert isinstance(value, str)- else:- raise AssertionError(f"Unexpected property type {property_type}")+ assert isinstance(value, property_type)def check_realm_default_update(diff --git a/zerver/lib/event_types.py b/zerver/lib/event_types.pyindex c8b99c1ce1a..d651c86ee1a 100644--- a/zerver/lib/event_types.py+++ b/zerver/lib/event_types.py@@ -552,7 +552,7 @@ class EventRealmUpdate(BaseEvent):type: Literal["realm"]op: Literal["update"]property: str- value: bool | int | str+ value: bool | int | str | Noneclass RealmUser(BaseModel):diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex b41724d6c90..66951a8b001 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -3804,15 +3804,15 @@ class RealmPropertyActionTest(BaseAction):video_chat_provider=[Realm.VIDEO_CHAT_PROVIDERS["jitsi_meet"]["id"],],- jitsi_server_url=["https://jitsi1.example.com", "https://jitsi2.example.com"],+ jitsi_server_url=["https://jitsi1.example.com", "https://jitsi2.example.com", None],giphy_rating=[Realm.GIPHY_RATING_OPTIONS["disabled"]["id"],],default_code_block_language=["python", "javascript"],- message_content_delete_limit_seconds=[1000, 1100, 1200],+ message_content_delete_limit_seconds=[1000, 1100, 1200, None],message_content_edit_limit_seconds=[1000, 1100, 1200, None],- move_messages_within_stream_limit_seconds=[1000, 1100, 1200],- move_messages_between_streams_limit_seconds=[1000, 1100, 1200],+ move_messages_within_stream_limit_seconds=[1000, 1100, 1200, None],+ move_messages_between_streams_limit_seconds=[1000, 1100, 1200, None],)vals = test_values.get(name)