Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
unread: Remove unused client parameter.
Steve Howella90d9ef536e4
diff --git a/analytics/tests/test_counts.py b/analytics/tests/test_counts.pyindex 64f93d6781d..a6a8f677dd8 100644--- a/analytics/tests/test_counts.py+++ b/analytics/tests/test_counts.py@@ -1431,8 +1431,7 @@ class TestLoggingCountStats(AnalyticsTestCase):self.subscribe(user2, stream.name)self.send_personal_message(user1, user2)- client = get_client("website")- do_mark_all_as_read(user2, client)+ do_mark_all_as_read(user2)self.assertEqual(1,UserCount.objects.filter(property=read_count_property).aggregate(Sum("value"))[@@ -1463,7 +1462,7 @@ class TestLoggingCountStats(AnalyticsTestCase):)message = self.send_stream_message(user2, stream.name)- do_update_message_flags(user1, client, "add", "read", [message])+ do_update_message_flags(user1, "add", "read", [message])self.assertEqual(4,UserCount.objects.filter(property=read_count_property).aggregate(Sum("value"))[diff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex 5e8ef5030a0..10939fc9a00 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -6151,7 +6151,7 @@ class ReadMessagesEvent:flag: str = field(default="read", init=False)-def do_mark_all_as_read(user_profile: UserProfile, client: Client) -> int:+def do_mark_all_as_read(user_profile: UserProfile) -> int:log_statsd_event("bankruptcy")# First, we clear mobile push notifications. This is safer in the@@ -6346,7 +6346,7 @@ def do_clear_mobile_push_notifications_for_ids(def do_update_message_flags(- user_profile: UserProfile, client: Client, operation: str, flag: str, messages: List[int]+ user_profile: UserProfile, operation: str, flag: str, messages: List[int]) -> int:valid_flags = [item for item in UserMessage.flags if item not in UserMessage.NON_API_FLAGS]if flag not in valid_flags:diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.pyindex 0f6df196138..1462234d34e 100644--- a/zerver/tests/test_events.py+++ b/zerver/tests/test_events.py@@ -625,17 +625,13 @@ class NormalActionsTest(BaseAction):)user_profile = self.example_user("hamlet")events = self.verify_action(- lambda: do_update_message_flags(- user_profile, get_client("website"), "add", "starred", [message]- ),+ lambda: do_update_message_flags(user_profile, "add", "starred", [message]),state_change_expected=True,)check_update_message_flags_add("events[0]", events[0])events = self.verify_action(- lambda: do_update_message_flags(- user_profile, get_client("website"), "remove", "starred", [message]- ),+ lambda: do_update_message_flags(user_profile, "remove", "starred", [message]),state_change_expected=True,)check_update_message_flags_remove("events[0]", events[0])@@ -653,9 +649,7 @@ class NormalActionsTest(BaseAction):)self.verify_action(- lambda: do_update_message_flags(- user_profile, get_client("website"), "add", "read", [message]- ),+ lambda: do_update_message_flags(user_profile, "add", "read", [message]),state_change_expected=True,)diff --git a/zerver/tests/test_push_notifications.py b/zerver/tests/test_push_notifications.pyindex e0aec5dc7a9..13cf263aab3 100644--- a/zerver/tests/test_push_notifications.py+++ b/zerver/tests/test_push_notifications.py@@ -1638,9 +1638,7 @@ class TestAPNs(PushNotificationTest):# Mark the messages as read and test whether# the count decreases correctly.for i, message_id in enumerate(message_ids):- do_update_message_flags(- user_profile, get_client("website"), "add", "read", [message_id]- )+ do_update_message_flags(user_profile, "add", "read", [message_id])self.assertEqual(get_apns_badge_count(user_profile), 0)self.assertEqual(get_apns_badge_count_future(user_profile), num_messages - i - 1)diff --git a/zerver/views/message_flags.py b/zerver/views/message_flags.pyindex 8e3660edf97..7ca7436910b 100644--- a/zerver/views/message_flags.py+++ b/zerver/views/message_flags.py@@ -36,10 +36,9 @@ def update_message_flags(flag: str = REQ(),) -> HttpResponse:request_notes = RequestNotes.get_notes(request)- assert request_notes.client is not Noneassert request_notes.log_data is not None- count = do_update_message_flags(user_profile, request_notes.client, operation, flag, messages)+ count = do_update_message_flags(user_profile, operation, flag, messages)target_count_str = str(len(messages))log_data_str = f"[{operation} {flag}/{target_count_str}] actually {count}"@@ -51,8 +50,7 @@ def update_message_flags(@has_request_variablesdef mark_all_as_read(request: HttpRequest, user_profile: UserProfile) -> HttpResponse:request_notes = RequestNotes.get_notes(request)- assert request_notes.client is not None- count = do_mark_all_as_read(user_profile, request_notes.client)+ count = do_mark_all_as_read(user_profile)log_data_str = f"[{count} updated]"assert request_notes.log_data is not None