mirror of https://github.com/zulip/zulip.git
typing_indicator: Remove the "private" compatibility support.
This commit removes the compatibility support for "private" being a valid value for the 'type' parameter in 'POST /typing'. "direct" and "stream" are the only valid values.
This commit is contained in:
parent
a22f637769
commit
8d8b6ef156
|
@ -26,6 +26,9 @@ format used by the Zulip server that they are interacting with.
|
|||
with `direct` in the `message_type` field for the `typing` events
|
||||
sent when a user starts or stops typing a message.
|
||||
|
||||
* [`POST /typing`](/api/set-typing-status): Stopped supporting `private`
|
||||
as a valid value for the `type` parameter.
|
||||
|
||||
**Feature level 214**
|
||||
|
||||
* [`PATCH /realm/user_settings_defaults`](/api/update-realm-user-settings-defaults),
|
||||
|
|
|
@ -16654,7 +16654,10 @@ paths:
|
|||
description: |
|
||||
Type of the message being composed.
|
||||
|
||||
**Changes**: In Zulip 7.0 (feature level 174), `"direct"` was added
|
||||
**Changes**: In Zulip 8.0 (feature level 215), stopped supporting
|
||||
`"private"` as a valid value for this parameter.
|
||||
|
||||
In Zulip 7.0 (feature level 174), `"direct"` was added
|
||||
as the preferred way to indicate a direct message is being composed,
|
||||
becoming the default value for this parameter and deprecating the
|
||||
original `"private"`.
|
||||
|
@ -16666,7 +16669,6 @@ paths:
|
|||
enum:
|
||||
- direct
|
||||
- stream
|
||||
- private
|
||||
default: direct
|
||||
example: direct
|
||||
- name: op
|
||||
|
|
|
@ -133,21 +133,19 @@ class TypingValidateToArgumentsTest(ZulipTestCase):
|
|||
|
||||
class TypingHappyPathTestPMs(ZulipTestCase):
|
||||
def test_valid_type_and_op_parameters(self) -> None:
|
||||
recipient_type_name = ["direct", "private"]
|
||||
operator_type = ["start", "stop"]
|
||||
sender = self.example_user("hamlet")
|
||||
recipient_user = self.example_user("othello")
|
||||
|
||||
for type in recipient_type_name:
|
||||
for operator in operator_type:
|
||||
params = dict(
|
||||
to=orjson.dumps([recipient_user.id]).decode(),
|
||||
op=operator,
|
||||
type=type,
|
||||
)
|
||||
for operator in operator_type:
|
||||
params = dict(
|
||||
to=orjson.dumps([recipient_user.id]).decode(),
|
||||
op=operator,
|
||||
type="direct",
|
||||
)
|
||||
|
||||
result = self.api_post(sender, "/api/v1/typing", params)
|
||||
self.assert_json_success(result)
|
||||
result = self.api_post(sender, "/api/v1/typing", params)
|
||||
self.assert_json_success(result)
|
||||
|
||||
def test_start_to_single_recipient(self) -> None:
|
||||
sender = self.example_user("hamlet")
|
||||
|
|
|
@ -9,9 +9,10 @@ from zerver.lib.request import REQ, has_request_variables
|
|||
from zerver.lib.response import json_success
|
||||
from zerver.lib.streams import access_stream_by_id, access_stream_for_send_message
|
||||
from zerver.lib.validator import check_int, check_list, check_string_in
|
||||
from zerver.models import Message, UserProfile
|
||||
from zerver.models import UserProfile
|
||||
|
||||
VALID_OPERATOR_TYPES = ["start", "stop"]
|
||||
VALID_RECIPIENT_TYPES = ["direct", "stream"]
|
||||
|
||||
|
||||
@has_request_variables
|
||||
|
@ -19,7 +20,7 @@ def send_notification_backend(
|
|||
request: HttpRequest,
|
||||
user_profile: UserProfile,
|
||||
req_type: str = REQ(
|
||||
"type", str_validator=check_string_in(Message.API_RECIPIENT_TYPES), default="direct"
|
||||
"type", str_validator=check_string_in(VALID_RECIPIENT_TYPES), default="direct"
|
||||
),
|
||||
operator: str = REQ("op", str_validator=check_string_in(VALID_OPERATOR_TYPES)),
|
||||
notification_to: List[int] = REQ("to", json_validator=check_list(check_int)),
|
||||
|
@ -31,9 +32,6 @@ def send_notification_backend(
|
|||
raise JsonableError(_("Empty 'to' list"))
|
||||
|
||||
recipient_type_name = req_type
|
||||
if recipient_type_name == "private":
|
||||
recipient_type_name = "direct"
|
||||
|
||||
if recipient_type_name == "stream":
|
||||
if to_length > 1:
|
||||
raise JsonableError(_("Cannot send to multiple streams"))
|
||||
|
|
Loading…
Reference in New Issue