mirror of https://github.com/zulip/zulip.git
user_mutes: Rename 'muting.py' to 'user_mutes.py'.
Rename 'muting.py' to 'user_mutes.py' because it, now , contains only user-mute related functions. Includes minor refactoring needed after renaming the file.
This commit is contained in:
parent
49577bbdcd
commit
906ff9243a
|
@ -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)
|
||||
|
|
|
@ -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/<int:muted_user_id>", 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"})),
|
||||
|
|
Loading…
Reference in New Issue