From a22f637769813b921946f21f3e952d070a0167ab Mon Sep 17 00:00:00 2001 From: Prakhar Pratyush Date: Sun, 1 Oct 2023 23:50:05 +0530 Subject: [PATCH] typing_indicator: Replace private with direct in 'message_type' field. This commit replaces the value `private` with `direct` in the `message_type` field for the `typing` events sent when a user starts or stops typing a message. --- api_docs/changelog.md | 6 ++++++ version.py | 2 +- web/tests/lib/events.js | 4 ++-- zerver/actions/typing.py | 2 +- zerver/lib/event_schema.py | 8 ++++---- zerver/openapi/zulip.yaml | 30 ++++++++++++++++++------------ zerver/views/typing.py | 1 - 7 files changed, 32 insertions(+), 21 deletions(-) diff --git a/api_docs/changelog.md b/api_docs/changelog.md index 501f836936..ba6cbfc80e 100644 --- a/api_docs/changelog.md +++ b/api_docs/changelog.md @@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with. ## Changes in Zulip 8.0 +**Feature level 215** + +* [`GET /events`](/api/get-events): Replaced the value `private` + with `direct` in the `message_type` field for the `typing` events + sent when a user starts or stops typing a message. + **Feature level 214** * [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults), diff --git a/version.py b/version.py index d737c9036b..b86e1316fb 100644 --- a/version.py +++ b/version.py @@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.9.3" # Changes should be accompanied by documentation explaining what the # new level means in api_docs/changelog.md, as well as "**Changes**" # entries in the endpoint's documentation in `zulip.yaml`. -API_FEATURE_LEVEL = 214 +API_FEATURE_LEVEL = 215 # Bump the minor PROVISION_VERSION to indicate that folks should provision # only when going from an old version of the code to a newer version. Bump diff --git a/web/tests/lib/events.js b/web/tests/lib/events.js index ee7754e712..fa27815d21 100644 --- a/web/tests/lib/events.js +++ b/web/tests/lib/events.js @@ -756,7 +756,7 @@ exports.fixtures = { typing__start: { type: "typing", op: "start", - message_type: "private", + message_type: "direct", sender: typing_person1, recipients: [typing_person2], }, @@ -764,7 +764,7 @@ exports.fixtures = { typing__stop: { type: "typing", op: "stop", - message_type: "private", + message_type: "direct", sender: typing_person1, recipients: [typing_person2], }, diff --git a/zerver/actions/typing.py b/zerver/actions/typing.py index f18ddf020b..adac26f14e 100644 --- a/zerver/actions/typing.py +++ b/zerver/actions/typing.py @@ -19,7 +19,7 @@ def do_send_typing_notification( ] event = dict( type="typing", - message_type="private", + message_type="direct", op=operator, sender=sender_dict, recipients=recipient_dicts, diff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.py index aab4e396f7..4d70a1dd80 100644 --- a/zerver/lib/event_schema.py +++ b/zerver/lib/event_schema.py @@ -1443,9 +1443,9 @@ typing_person_type = DictType( ] ) -equals_private_or_stream = EnumType( +equals_direct_or_stream = EnumType( [ - "private", + "direct", "stream", ] ) @@ -1454,7 +1454,7 @@ typing_start_event = event_dict_type( required_keys=[ ("type", Equals("typing")), ("op", Equals("start")), - ("message_type", equals_private_or_stream), + ("message_type", equals_direct_or_stream), ("sender", typing_person_type), ], optional_keys=[ @@ -1469,7 +1469,7 @@ typing_stop_event = event_dict_type( required_keys=[ ("type", Equals("typing")), ("op", Equals("stop")), - ("message_type", equals_private_or_stream), + ("message_type", equals_direct_or_stream), ("sender", typing_person_type), ], optional_keys=[ diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index d2f247a410..d810ce7b03 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -2523,12 +2523,15 @@ paths: message_type: type: string description: | - Type of message being composed. Must be `"stream"` or `"private"`. + Type of message being composed. Must be `"stream"` or `"direct"`. - **Changes**: New in Zulip 4.0 (feature level 58). Previously, - all typing notifications were implicitly direct messages. + **Changes**: In Zulip 8.0 (feature level 215), replaced the + value `"private"` with `"direct"`. + + New in Zulip 4.0 (feature level 58). Previously, all typing + notifications were implicitly direct messages. enum: - - private + - direct - stream sender: additionalProperties: false @@ -2547,7 +2550,7 @@ paths: recipients: type: array description: | - Only present if `message_type` is `"private"`. + Only present if `message_type` is `"direct"`. Array of dictionaries describing the set of users who would be recipients of the message being typed. Each dictionary contains @@ -2589,7 +2592,7 @@ paths: { "type": "typing", "op": "start", - "message_type": "private", + "message_type": "direct", "sender": { "user_id": 10, @@ -2641,12 +2644,15 @@ paths: message_type: type: string description: | - Type of message being composed. Must be `"stream"` or `"private"`. + Type of message being composed. Must be `"stream"` or `"direct"`. - **Changes**: New in Zulip 4.0 (feature level 58). Previously, - all typing notifications were implicitly direct messages. + **Changes**: In Zulip 8.0 (feature level 215), replaced the + value `"private"` with `"direct"`. + + New in Zulip 4.0 (feature level 58). Previously all typing + notifications were implicitly direct messages. enum: - - private + - direct - stream sender: additionalProperties: false @@ -2665,7 +2671,7 @@ paths: recipients: type: array description: | - Only present if `message_type` is `"private"`. + Only present if `message_type` is `"direct"`. Array of dictionaries describing the set of users who would be recipients of the message that was previously being typed. Each @@ -2707,7 +2713,7 @@ paths: { "type": "typing", "op": "stop", - "message_type": "private", + "message_type": "direct", "sender": { "user_id": 10, diff --git a/zerver/views/typing.py b/zerver/views/typing.py index bc1ca7912f..87d0bf1f52 100644 --- a/zerver/views/typing.py +++ b/zerver/views/typing.py @@ -32,7 +32,6 @@ def send_notification_backend( recipient_type_name = req_type if recipient_type_name == "private": - # TODO: Use "direct" in typing notification events. recipient_type_name = "direct" if recipient_type_name == "stream":