mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
typing: Support sending stream/topic typing status.
This extends the /json/typing endpoint to also accept
stream_id and topic. With this change, the requests
sent to /json/typing should have these:
* `to`: a list set to
- recipients for a PM
- stream_id for a stream message
* `topic`, in case of stream message
along with `op`(start or stop).
On receiving a request with stream_id and topic, we send
typing events to clients with stream_typing_notifications set
to True for all users subscribed to that stream.
This commit is contained in:
@@ -1186,6 +1186,7 @@ def set_typing_status(client: Client) -> None:
|
||||
"to": [user_id1, user_id2],
|
||||
}
|
||||
result = client.set_typing_status(request)
|
||||
|
||||
# {code_example|end}
|
||||
|
||||
validate_against_openapi_schema(result, "/typing", "post", "200")
|
||||
@@ -1200,6 +1201,41 @@ def set_typing_status(client: Client) -> None:
|
||||
"to": [user_id1, user_id2],
|
||||
}
|
||||
result = client.set_typing_status(request)
|
||||
|
||||
# {code_example|end}
|
||||
|
||||
validate_against_openapi_schema(result, "/typing", "post", "200")
|
||||
|
||||
# {code_example|start}
|
||||
# The user has started to type in topic "typing status" of stream "Denmark"
|
||||
stream_id = client.get_stream_id("Denmark")["stream_id"]
|
||||
topic = "typing status"
|
||||
|
||||
request = {
|
||||
"type": "stream",
|
||||
"op": "start",
|
||||
"to": [stream_id],
|
||||
"topic": topic,
|
||||
}
|
||||
result = client.set_typing_status(request)
|
||||
|
||||
# {code_example|end}
|
||||
|
||||
validate_against_openapi_schema(result, "/typing", "post", "200")
|
||||
|
||||
# {code_example|start}
|
||||
# The user has finished typing in topic "typing status" of stream "Denmark"
|
||||
stream_id = client.get_stream_id("Denmark")["stream_id"]
|
||||
topic = "typing status"
|
||||
|
||||
request = {
|
||||
"type": "stream",
|
||||
"op": "stop",
|
||||
"to": [stream_id],
|
||||
"topic": topic,
|
||||
}
|
||||
result = client.set_typing_status(request)
|
||||
|
||||
# {code_example|end}
|
||||
|
||||
validate_against_openapi_schema(result, "/typing", "post", "200")
|
||||
|
||||
Reference in New Issue
Block a user