muted users: Make file naming consistent.

This makes the names of the relevant files consistant with the database
model name as well as the frontend JS files.
This commit is contained in:
Abhijeet Prasad Bodas 2023-02-10 19:03:24 +05:30 committed by Tim Abbott
parent 81d1be011d
commit 9d1c131dc6
9 changed files with 12 additions and 12 deletions

View File

@ -51,6 +51,7 @@ from zerver.lib.message import (
truncate_topic, truncate_topic,
wildcard_mention_allowed, wildcard_mention_allowed,
) )
from zerver.lib.muted_users import get_muting_users
from zerver.lib.notification_data import UserMessageNotificationsData, get_user_group_mentions_data from zerver.lib.notification_data import UserMessageNotificationsData, get_user_group_mentions_data
from zerver.lib.queue import queue_json_publish from zerver.lib.queue import queue_json_publish
from zerver.lib.recipient_users import recipient_for_user_profiles from zerver.lib.recipient_users import recipient_for_user_profiles
@ -65,7 +66,6 @@ from zerver.lib.timestamp import timestamp_to_datetime
from zerver.lib.topic import filter_by_exact_message_topic from zerver.lib.topic import filter_by_exact_message_topic
from zerver.lib.url_preview.types import UrlEmbedData from zerver.lib.url_preview.types import UrlEmbedData
from zerver.lib.user_message import UserMessageLite, bulk_insert_ums from zerver.lib.user_message import UserMessageLite, bulk_insert_ums
from zerver.lib.user_mutes import get_muting_users
from zerver.lib.validator import check_widget_content from zerver.lib.validator import check_widget_content
from zerver.lib.widget import do_widget_post_save_actions from zerver.lib.widget import do_widget_post_save_actions
from zerver.models import ( from zerver.models import (

View File

@ -5,7 +5,7 @@ import orjson
from django.utils.timezone import now as timezone_now from django.utils.timezone import now as timezone_now
from zerver.actions.message_flags import do_mark_muted_user_messages_as_read from zerver.actions.message_flags import do_mark_muted_user_messages_as_read
from zerver.lib.user_mutes import add_user_mute, get_user_mutes from zerver.lib.muted_users import add_user_mute, get_user_mutes
from zerver.models import MutedUser, RealmAuditLog, UserProfile from zerver.models import MutedUser, RealmAuditLog, UserProfile
from zerver.tornado.django_api import send_event from zerver.tornado.django_api import send_event

View File

@ -34,6 +34,7 @@ from zerver.lib.message import (
get_starred_message_ids, get_starred_message_ids,
remove_message_id_from_unread_mgs, remove_message_id_from_unread_mgs,
) )
from zerver.lib.muted_users import get_user_mutes
from zerver.lib.narrow import check_supported_events_narrow_filter, read_stop_words from zerver.lib.narrow import check_supported_events_narrow_filter, read_stop_words
from zerver.lib.presence import get_presence_for_user, get_presences_for_realm from zerver.lib.presence import get_presence_for_user, get_presences_for_realm
from zerver.lib.push_notifications import push_notifications_enabled from zerver.lib.push_notifications import push_notifications_enabled
@ -48,7 +49,6 @@ from zerver.lib.timestamp import datetime_to_timestamp
from zerver.lib.timezone import canonicalize_timezone from zerver.lib.timezone import canonicalize_timezone
from zerver.lib.topic import TOPIC_NAME from zerver.lib.topic import TOPIC_NAME
from zerver.lib.user_groups import user_groups_in_realm_serialized from zerver.lib.user_groups import user_groups_in_realm_serialized
from zerver.lib.user_mutes import get_user_mutes
from zerver.lib.user_status import get_user_status_dict from zerver.lib.user_status import get_user_status_dict
from zerver.lib.user_topics import get_topic_mutes, get_user_topics from zerver.lib.user_topics import get_topic_mutes, get_user_topics
from zerver.lib.users import get_cross_realm_dicts, get_raw_user_data, is_administrator_role from zerver.lib.users import get_cross_realm_dicts, get_raw_user_data, is_administrator_role

View File

@ -189,6 +189,7 @@ from zerver.lib.events import (
) )
from zerver.lib.mention import MentionBackend, MentionData from zerver.lib.mention import MentionBackend, MentionData
from zerver.lib.message import render_markdown from zerver.lib.message import render_markdown
from zerver.lib.muted_users import get_mute_object
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.test_helpers import ( from zerver.lib.test_helpers import (
create_dummy_file, create_dummy_file,
@ -200,7 +201,6 @@ from zerver.lib.test_helpers import (
from zerver.lib.topic import TOPIC_NAME from zerver.lib.topic import TOPIC_NAME
from zerver.lib.types import ProfileDataElementUpdateDict from zerver.lib.types import ProfileDataElementUpdateDict
from zerver.lib.user_groups import create_user_group from zerver.lib.user_groups import create_user_group
from zerver.lib.user_mutes import get_mute_object
from zerver.models import ( from zerver.models import (
Attachment, Attachment,
CustomProfileField, CustomProfileField,

View File

@ -5,9 +5,9 @@ import orjson
from zerver.actions.users import do_deactivate_user from zerver.actions.users import do_deactivate_user
from zerver.lib.cache import cache_get, get_muting_users_cache_key from zerver.lib.cache import cache_get, get_muting_users_cache_key
from zerver.lib.muted_users import get_mute_object, get_muting_users, get_user_mutes
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.timestamp import datetime_to_timestamp from zerver.lib.timestamp import datetime_to_timestamp
from zerver.lib.user_mutes import get_mute_object, get_muting_users, get_user_mutes
from zerver.models import RealmAuditLog, UserMessage, UserProfile from zerver.models import RealmAuditLog, UserMessage, UserProfile
@ -21,7 +21,7 @@ class MutedUsersTests(ZulipTestCase):
self.assertEqual(muted_users, []) self.assertEqual(muted_users, [])
mute_time = datetime(2021, 1, 1, tzinfo=timezone.utc) mute_time = datetime(2021, 1, 1, tzinfo=timezone.utc)
with mock.patch("zerver.views.user_mutes.timezone_now", return_value=mute_time): with mock.patch("zerver.views.muted_users.timezone_now", return_value=mute_time):
url = f"/api/v1/users/me/muted_users/{cordelia.id}" url = f"/api/v1/users/me/muted_users/{cordelia.id}"
result = self.api_post(hamlet, url) result = self.api_post(hamlet, url)
self.assert_json_success(result) self.assert_json_success(result)
@ -80,7 +80,7 @@ class MutedUsersTests(ZulipTestCase):
# IntegrityError we'll get with a race between two processes # IntegrityError we'll get with a race between two processes
# trying to mute the user. To do this, we patch the # trying to mute the user. To do this, we patch the
# get_mute_object function to always return None. # get_mute_object function to always return None.
with mock.patch("zerver.views.user_mutes.get_mute_object", return_value=None): with mock.patch("zerver.views.muted_users.get_mute_object", return_value=None):
result = self.api_post(hamlet, url) result = self.api_post(hamlet, url)
self.assert_json_error(result, "User already muted") self.assert_json_error(result, "User already muted")
@ -93,7 +93,7 @@ class MutedUsersTests(ZulipTestCase):
if deactivate_user: if deactivate_user:
do_deactivate_user(cordelia, acting_user=None) do_deactivate_user(cordelia, acting_user=None)
with mock.patch("zerver.views.user_mutes.timezone_now", return_value=mute_time): with mock.patch("zerver.views.muted_users.timezone_now", return_value=mute_time):
url = f"/api/v1/users/me/muted_users/{cordelia.id}" url = f"/api/v1/users/me/muted_users/{cordelia.id}"
result = self.api_post(hamlet, url) result = self.api_post(hamlet, url)
self.assert_json_success(result) self.assert_json_success(result)
@ -147,7 +147,7 @@ class MutedUsersTests(ZulipTestCase):
if deactivate_user: if deactivate_user:
do_deactivate_user(cordelia, acting_user=None) do_deactivate_user(cordelia, acting_user=None)
with mock.patch("zerver.views.user_mutes.timezone_now", return_value=mute_time): with mock.patch("zerver.views.muted_users.timezone_now", return_value=mute_time):
url = f"/api/v1/users/me/muted_users/{cordelia.id}" url = f"/api/v1/users/me/muted_users/{cordelia.id}"
result = self.api_post(hamlet, url) result = self.api_post(hamlet, url)
self.assert_json_success(result) self.assert_json_success(result)

View File

@ -5,8 +5,8 @@ from zerver.actions.create_user import do_reactivate_user
from zerver.actions.realm_settings import do_set_realm_property from zerver.actions.realm_settings import do_set_realm_property
from zerver.actions.user_settings import do_change_user_setting from zerver.actions.user_settings import do_change_user_setting
from zerver.actions.users import do_deactivate_user from zerver.actions.users import do_deactivate_user
from zerver.lib.muted_users import add_user_mute, get_mute_object
from zerver.lib.test_classes import ZulipTestCase from zerver.lib.test_classes import ZulipTestCase
from zerver.lib.user_mutes import add_user_mute, get_mute_object
from zerver.models import UserMessage, UserProfile from zerver.models import UserMessage, UserProfile

View File

@ -6,7 +6,7 @@ from django.utils.translation import gettext as _
from zerver.actions.muted_users import do_mute_user, do_unmute_user from zerver.actions.muted_users import do_mute_user, do_unmute_user
from zerver.lib.exceptions import JsonableError from zerver.lib.exceptions import JsonableError
from zerver.lib.response import json_success from zerver.lib.response import json_success
from zerver.lib.user_mutes import get_mute_object from zerver.lib.muted_users import get_mute_object
from zerver.lib.users import access_user_by_id from zerver.lib.users import access_user_by_id
from zerver.models import UserProfile from zerver.models import UserProfile

View File

@ -79,6 +79,7 @@ from zerver.views.message_flags import (
update_message_flags_for_narrow, update_message_flags_for_narrow,
) )
from zerver.views.message_send import render_message_backend, send_message_backend, zcommand_backend from zerver.views.message_send import render_message_backend, send_message_backend, zcommand_backend
from zerver.views.muted_users import mute_user, unmute_user
from zerver.views.presence import ( from zerver.views.presence import (
get_presence_backend, get_presence_backend,
get_statuses_for_realm, get_statuses_for_realm,
@ -182,7 +183,6 @@ from zerver.views.user_groups import (
update_subgroups_of_user_group, update_subgroups_of_user_group,
update_user_group_backend, update_user_group_backend,
) )
from zerver.views.user_mutes import mute_user, unmute_user
from zerver.views.user_settings import ( from zerver.views.user_settings import (
confirm_email_change, confirm_email_change,
delete_avatar_backend, delete_avatar_backend,