Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
muted users: Add support to muting bots.
Zixuan James Li693b3679e348
diff --git a/api_docs/changelog.md b/api_docs/changelog.mdindex d84a4f13de4..10b9919ef71 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 maintenancereleases.diff --git a/version.py b/version.pyindex 2028bf0f750..bcca10341b7 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. Bumpdiff --git a/web/src/popovers.js b/web/src/popovers.jsindex d8074a23d7a..0b8ccc2e6ff 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.yamlindex b60259080fe..0a691246faa 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -18776,6 +18776,8 @@ components:in: pathdescription: |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: integerexample: 10diff --git a/zerver/tests/test_muted_users.py b/zerver/tests/test_muted_users.pyindex 6de0d8642f5..bdcc41847e9 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.pyindex 39ed4a0c237..c0847f9956f 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: inraise 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)