Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

mute user: Remove unnecessary check for double muting.

Abhijeet Prasad Bodas9fde88796ab0
diff --git a/zerver/tests/test_muted_users.py b/zerver/tests/test_muted_users.py
index 5cee6101232..6de0d8642f5 100644
--- a/zerver/tests/test_muted_users.py
+++ b/zerver/tests/test_muted_users.py
@@ -76,14 +76,6 @@ class MutedUsersTests(ZulipTestCase):
result = self.api_post(hamlet, url)
self.assert_json_error(result, "User already muted")
- # Verify the error handling for the database level
- # IntegrityError we'll get with a race between two processes
- # trying to mute the user. To do this, we patch the
- # get_mute_object function to always return None.
- with mock.patch("zerver.views.muted_users.get_mute_object", return_value=None):
- result = self.api_post(hamlet, url)
- self.assert_json_error(result, "User already muted")
-
def _test_add_muted_user_valid_data(self, deactivate_user: bool = False) -> None:
hamlet = self.example_user("hamlet")
self.login_user(hamlet)
diff --git a/zerver/views/muted_users.py b/zerver/views/muted_users.py
index 86945ba82c9..39ed4a0c237 100644
--- a/zerver/views/muted_users.py
+++ b/zerver/views/muted_users.py
@@ -20,9 +20,6 @@ def mute_user(request: HttpRequest, user_profile: UserProfile, muted_user_id: in
)
date_muted = timezone_now()
- if get_mute_object(user_profile, muted_user) is not None:
- raise JsonableError(_("User already muted"))
-
try:
do_mute_user(user_profile, muted_user, date_muted)
except IntegrityError: