mirror of https://github.com/zulip/zulip.git
muted users: Add support to muting bots.
We intentionally disallow muting bots previously upon a pending design decision in #16915. This lifts that constraint. Fixes #22693.
This commit is contained in:
parent
27664459cb
commit
693b3679e3
|
@ -20,6 +20,12 @@ format used by the Zulip server that they are interacting with.
|
|||
|
||||
## Changes in Zulip 8.0
|
||||
|
||||
**Feature level 188**
|
||||
|
||||
* [`POST /users/me/muted_users/{muted_user_id}`](/api/mute-user),
|
||||
[`DELETE /users/me/muted_users/{muted_user_id}`](/api/unmute-user):
|
||||
Added support to mute/unmute bot users.
|
||||
|
||||
Feature levels 186-187 are reserved for future use in 7.x maintenance
|
||||
releases.
|
||||
|
||||
|
|
|
@ -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 = 185
|
||||
API_FEATURE_LEVEL = 188
|
||||
|
||||
# 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
|
||||
|
|
|
@ -193,7 +193,7 @@ function show_user_info_popover_manage_menu(element, user) {
|
|||
const is_me = people.is_my_user_id(user.user_id);
|
||||
const is_muted = muted_users.is_user_muted(user.user_id);
|
||||
const is_system_bot = user.is_system_bot;
|
||||
const muting_allowed = !is_me && !user.is_bot;
|
||||
const muting_allowed = !is_me;
|
||||
|
||||
const args = {
|
||||
can_mute: muting_allowed && !is_muted,
|
||||
|
|
|
@ -18776,6 +18776,8 @@ components:
|
|||
in: path
|
||||
description: |
|
||||
The ID of the user to mute/un-mute.
|
||||
|
||||
**Changes**: Before Zulip 8.0 (feature level 188), it was an error to specify a bot user.
|
||||
schema:
|
||||
type: integer
|
||||
example: 10
|
||||
|
|
|
@ -59,9 +59,11 @@ class MutedUsersTests(ZulipTestCase):
|
|||
|
||||
url = f"/api/v1/users/me/muted_users/{muted_id}"
|
||||
result = self.api_post(hamlet, url)
|
||||
# Currently we do not allow muting bots. This is the error message
|
||||
# from `access_user_by_id`.
|
||||
self.assert_json_error(result, "No such user")
|
||||
self.assert_json_success(result)
|
||||
|
||||
url = f"/api/v1/users/me/muted_users/{muted_id}"
|
||||
result = self.api_delete(hamlet, url)
|
||||
self.assert_json_success(result)
|
||||
|
||||
def test_add_muted_user_mute_twice(self) -> None:
|
||||
hamlet = self.example_user("hamlet")
|
||||
|
|
|
@ -16,7 +16,7 @@ def mute_user(request: HttpRequest, user_profile: UserProfile, muted_user_id: in
|
|||
raise JsonableError(_("Cannot mute self"))
|
||||
|
||||
muted_user = access_user_by_id(
|
||||
user_profile, muted_user_id, allow_bots=False, allow_deactivated=True, for_admin=False
|
||||
user_profile, muted_user_id, allow_bots=True, allow_deactivated=True, for_admin=False
|
||||
)
|
||||
date_muted = timezone_now()
|
||||
|
||||
|
@ -32,7 +32,7 @@ def unmute_user(
|
|||
request: HttpRequest, user_profile: UserProfile, muted_user_id: int
|
||||
) -> HttpResponse:
|
||||
muted_user = access_user_by_id(
|
||||
user_profile, muted_user_id, allow_bots=False, allow_deactivated=True, for_admin=False
|
||||
user_profile, muted_user_id, allow_bots=True, allow_deactivated=True, for_admin=False
|
||||
)
|
||||
mute_object = get_mute_object(user_profile, muted_user)
|
||||
|
||||
|
|
Loading…
Reference in New Issue