Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
events: Add documentation and tests for `typing: stop` event.
orientor148c375e5b07
diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.pyindex 5edc23c586d..f3832808fb9 100644--- a/zerver/lib/event_schema.py+++ b/zerver/lib/event_schema.py@@ -669,6 +669,15 @@ check_typing_start = check_events_dict(])+check_typing_stop = check_events_dict(+ required_keys=[+ ("type", equals("typing")),+ ("op", equals("stop")),+ ("sender", _check_typing_person),+ ("recipients", check_list(_check_typing_person)),+ ]+)+_check_update_display_settings = check_events_dict(required_keys=[("type", equals("update_display_settings")),diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex f5b3356b071..1a6bd7a5f3c 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -1962,7 +1962,9 @@ paths:additionalProperties: falsedescription: |Event sent when a user starts typing a private or group private message. Sent- to all clients for users who would receive the message being typed.+ to all clients for users who would receive the message being typed. It should+ be noted that clients should set their own timeouts to stop the typing status+ incase `typing: stop` event is not received.properties:id:type: integer@@ -2031,6 +2033,79 @@ paths:],"id": 0,}+ - type: object+ additionalProperties: false+ description: |+ Event sent when a user stops typing a private or group private message. Sent+ to all clients for users who would receive the message being typed.+ properties:+ id:+ type: integer+ type:+ type: string+ enum:+ - typing+ op:+ type: string+ enum:+ - stop+ sender:+ additionalProperties: false+ type: object+ description: |+ Object containing user id and email of the sender i.e+ the user who has stopped typing.+ properties:+ user_id:+ type: integer+ description: |+ The ID of the user.+ email:+ type: string+ description: |+ The Zulip display email address for the user.+ recipients:+ type: array+ description: |+ Array of dictionaries, where each dictionary contains the+ email and user_id of a single user who will receive the+ typed message.+ items:+ type: object+ additionalProperties: false+ description: |+ Object containing the user id and email of a recipient.+ properties:+ user_id:+ type: integer+ description: |+ The ID of the user.+ email:+ type: string+ description: |+ The Zulip display email address for the user.+ example:+ {+ "type": "typing",+ "op": "stop",+ "sender":+ {+ "user_id": 10,+ "email": "[email protected]",+ },+ "recipients":+ [+ {+ "user_id": 8,+ "email": "[email protected]",+ },+ {+ "user_id": 10,+ "email": "[email protected]",+ },+ ],+ "id": 0,+ }- type: objectadditionalProperties: falsedescription: |diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex 85108dce701..bc20dacaa85 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -114,6 +114,7 @@ from zerver.lib.event_schema import (check_subscription_peer_remove,check_subscription_remove,check_typing_start,+ check_typing_stop,check_update_display_settings,check_update_global_notifications,check_update_message,@@ -632,6 +633,12 @@ class NormalActionsTest(BaseAction):state_change_expected=False,)check_typing_start('events[0]', events[0])+ events = self.verify_action(+ lambda: check_send_typing_notification(+ self.user_profile, [self.example_user("cordelia").id], "stop"),+ state_change_expected=False,+ )+ check_typing_stop('events[0]', events[0])def test_custom_profile_fields_events(self) -> None:events = self.verify_action(