diff --git a/zerver/tests/test_muting_users.py b/zerver/tests/test_muting_users.py index a1914bfcff..a9803f2f50 100644 --- a/zerver/tests/test_muting_users.py +++ b/zerver/tests/test_muting_users.py @@ -21,7 +21,7 @@ class MutedUsersTests(ZulipTestCase): self.assertEqual(muted_users, []) mute_time = datetime(2021, 1, 1, tzinfo=timezone.utc) - with mock.patch("zerver.views.muting.timezone_now", return_value=mute_time): + with mock.patch("zerver.views.user_mutes.timezone_now", return_value=mute_time): url = f"/api/v1/users/me/muted_users/{cordelia.id}" result = self.api_post(hamlet, url) self.assert_json_success(result) @@ -80,7 +80,7 @@ class MutedUsersTests(ZulipTestCase): # 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.muting.get_mute_object", return_value=None): + with mock.patch("zerver.views.user_mutes.get_mute_object", return_value=None): result = self.api_post(hamlet, url) self.assert_json_error(result, "User already muted") @@ -93,7 +93,7 @@ class MutedUsersTests(ZulipTestCase): if deactivate_user: do_deactivate_user(cordelia, acting_user=None) - with mock.patch("zerver.views.muting.timezone_now", return_value=mute_time): + with mock.patch("zerver.views.user_mutes.timezone_now", return_value=mute_time): url = f"/api/v1/users/me/muted_users/{cordelia.id}" result = self.api_post(hamlet, url) self.assert_json_success(result) @@ -147,7 +147,7 @@ class MutedUsersTests(ZulipTestCase): if deactivate_user: do_deactivate_user(cordelia, acting_user=None) - with mock.patch("zerver.views.muting.timezone_now", return_value=mute_time): + with mock.patch("zerver.views.user_mutes.timezone_now", return_value=mute_time): url = f"/api/v1/users/me/muted_users/{cordelia.id}" result = self.api_post(hamlet, url) self.assert_json_success(result) diff --git a/zerver/views/muting.py b/zerver/views/user_mutes.py similarity index 100% rename from zerver/views/muting.py rename to zerver/views/user_mutes.py diff --git a/zproject/urls.py b/zproject/urls.py index 9dee2c2ddb..b918aa1ec3 100644 --- a/zproject/urls.py +++ b/zproject/urls.py @@ -79,7 +79,6 @@ from zerver.views.message_flags import ( update_message_flags_for_narrow, ) from zerver.views.message_send import render_message_backend, send_message_backend, zcommand_backend -from zerver.views.muting import mute_user, unmute_user from zerver.views.presence import ( get_presence_backend, get_statuses_for_realm, @@ -183,6 +182,7 @@ from zerver.views.user_groups import ( update_subgroups_of_user_group, update_user_group_backend, ) +from zerver.views.user_mutes import mute_user, unmute_user from zerver.views.user_settings import ( confirm_email_change, delete_avatar_backend, @@ -473,8 +473,9 @@ v1_api_and_json_patterns = [ PATCH=update_subscriptions_backend, DELETE=remove_subscriptions_backend, ), - # muting -> zerver.views.muting + # topic-muting -> zerver.views.user_topics rest_path("users/me/subscriptions/muted_topics", PATCH=update_muted_topic), + # user-muting -> zerver.views.user_mutes rest_path("users/me/muted_users/", POST=mute_user, DELETE=unmute_user), # used to register for an event queue in tornado rest_path("register", POST=(events_register_backend, {"allow_anonymous_user_web"})),