diff --git a/api_docs/changelog.md b/api_docs/changelog.md index d84a4f13de..10b9919ef7 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 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. diff --git a/version.py b/version.py index 2028bf0f75..bcca10341b 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 = 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 diff --git a/web/src/popovers.js b/web/src/popovers.js index d8074a23d7..0b8ccc2e6f 100644 --- a/web/src/popovers.js +++ b/web/src/popovers.js @@ -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, diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml index b60259080f..0a691246fa 100644 --- a/zerver/openapi/zulip.yaml +++ b/zerver/openapi/zulip.yaml @@ -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 diff --git a/zerver/tests/test_muted_users.py b/zerver/tests/test_muted_users.py index 6de0d8642f..bdcc41847e 100644 --- a/zerver/tests/test_muted_users.py +++ b/zerver/tests/test_muted_users.py @@ -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") diff --git a/zerver/views/muted_users.py b/zerver/views/muted_users.py index 39ed4a0c23..c0847f9956 100644 --- a/zerver/views/muted_users.py +++ b/zerver/views/muted_users.py @@ -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)