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.
This commit is contained in:
Prakhar Pratyush 2023-10-01 23:50:05 +05:30 committed by Tim Abbott
parent 5817da709c
commit a22f637769
7 changed files with 32 additions and 21 deletions

View File

@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 8.0 ## 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** **Feature level 214**
* [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults), * [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults),

View File

@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
# Changes should be accompanied by documentation explaining what the # Changes should be accompanied by documentation explaining what the
# new level means in api_docs/changelog.md, as well as "**Changes**" # new level means in api_docs/changelog.md, as well as "**Changes**"
# entries in the endpoint's documentation in `zulip.yaml`. # 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 # 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 # only when going from an old version of the code to a newer version. Bump

View File

@ -756,7 +756,7 @@ exports.fixtures = {
typing__start: { typing__start: {
type: "typing", type: "typing",
op: "start", op: "start",
message_type: "private", message_type: "direct",
sender: typing_person1, sender: typing_person1,
recipients: [typing_person2], recipients: [typing_person2],
}, },
@ -764,7 +764,7 @@ exports.fixtures = {
typing__stop: { typing__stop: {
type: "typing", type: "typing",
op: "stop", op: "stop",
message_type: "private", message_type: "direct",
sender: typing_person1, sender: typing_person1,
recipients: [typing_person2], recipients: [typing_person2],
}, },

View File

@ -19,7 +19,7 @@ def do_send_typing_notification(
] ]
event = dict( event = dict(
type="typing", type="typing",
message_type="private", message_type="direct",
op=operator, op=operator,
sender=sender_dict, sender=sender_dict,
recipients=recipient_dicts, recipients=recipient_dicts,

View File

@ -1443,9 +1443,9 @@ typing_person_type = DictType(
] ]
) )
equals_private_or_stream = EnumType( equals_direct_or_stream = EnumType(
[ [
"private", "direct",
"stream", "stream",
] ]
) )
@ -1454,7 +1454,7 @@ typing_start_event = event_dict_type(
required_keys=[ required_keys=[
("type", Equals("typing")), ("type", Equals("typing")),
("op", Equals("start")), ("op", Equals("start")),
("message_type", equals_private_or_stream), ("message_type", equals_direct_or_stream),
("sender", typing_person_type), ("sender", typing_person_type),
], ],
optional_keys=[ optional_keys=[
@ -1469,7 +1469,7 @@ typing_stop_event = event_dict_type(
required_keys=[ required_keys=[
("type", Equals("typing")), ("type", Equals("typing")),
("op", Equals("stop")), ("op", Equals("stop")),
("message_type", equals_private_or_stream), ("message_type", equals_direct_or_stream),
("sender", typing_person_type), ("sender", typing_person_type),
], ],
optional_keys=[ optional_keys=[

View File

@ -2523,12 +2523,15 @@ paths:
message_type: message_type:
type: string type: string
description: | 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, **Changes**: In Zulip 8.0 (feature level 215), replaced the
all typing notifications were implicitly direct messages. value `"private"` with `"direct"`.
New in Zulip 4.0 (feature level 58). Previously, all typing
notifications were implicitly direct messages.
enum: enum:
- private - direct
- stream - stream
sender: sender:
additionalProperties: false additionalProperties: false
@ -2547,7 +2550,7 @@ paths:
recipients: recipients:
type: array type: array
description: | 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 Array of dictionaries describing the set of users who would be
recipients of the message being typed. Each dictionary contains recipients of the message being typed. Each dictionary contains
@ -2589,7 +2592,7 @@ paths:
{ {
"type": "typing", "type": "typing",
"op": "start", "op": "start",
"message_type": "private", "message_type": "direct",
"sender": "sender":
{ {
"user_id": 10, "user_id": 10,
@ -2641,12 +2644,15 @@ paths:
message_type: message_type:
type: string type: string
description: | 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, **Changes**: In Zulip 8.0 (feature level 215), replaced the
all typing notifications were implicitly direct messages. value `"private"` with `"direct"`.
New in Zulip 4.0 (feature level 58). Previously all typing
notifications were implicitly direct messages.
enum: enum:
- private - direct
- stream - stream
sender: sender:
additionalProperties: false additionalProperties: false
@ -2665,7 +2671,7 @@ paths:
recipients: recipients:
type: array type: array
description: | 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 Array of dictionaries describing the set of users who would be
recipients of the message that was previously being typed. Each recipients of the message that was previously being typed. Each
@ -2707,7 +2713,7 @@ paths:
{ {
"type": "typing", "type": "typing",
"op": "stop", "op": "stop",
"message_type": "private", "message_type": "direct",
"sender": "sender":
{ {
"user_id": 10, "user_id": 10,

View File

@ -32,7 +32,6 @@ def send_notification_backend(
recipient_type_name = req_type recipient_type_name = req_type
if recipient_type_name == "private": if recipient_type_name == "private":
# TODO: Use "direct" in typing notification events.
recipient_type_name = "direct" recipient_type_name = "direct"
if recipient_type_name == "stream": if recipient_type_name == "stream":