Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
message_send: Include service bots as UserMessage eligible.
PieterCK25f64a9a67cd
diff --git a/zerver/actions/message_send.py b/zerver/actions/message_send.pyindex 639131ef864..759a5fc57dd 100644--- a/zerver/actions/message_send.py+++ b/zerver/actions/message_send.py@@ -443,10 +443,7 @@ def get_recipient_info(lambda r: not r["enable_offline_push_notifications"])- # Service bots don't get UserMessage rows.- um_eligible_user_ids = get_ids_for(- lambda r: not r["is_bot"] or r["bot_type"] not in UserProfile.SERVICE_BOT_TYPES,- )+ um_eligible_user_ids = get_ids_for(lambda r: True)long_term_idle_user_ids = get_ids_for(lambda r: r["long_term_idle"],diff --git a/zerver/tests/test_message_flags.py b/zerver/tests/test_message_flags.pyindex bacbe6357b4..5f430362de4 100644--- a/zerver/tests/test_message_flags.py+++ b/zerver/tests/test_message_flags.py@@ -1814,6 +1814,12 @@ class MessageAccessTests(ZulipTestCase):)self.assert_length(filtered_messages, 4)+ # Test private message access for service bot+ service_bot = self.example_user("outgoing_webhook_bot")+ self.subscribe(service_bot, stream_name)+ filtered_messages = self.assert_bulk_access(service_bot, more_message_ids, stream, 6, 2)+ self.assert_length(filtered_messages, 4)+# Verify an exception is thrown if called where the passed# stream not matching the messages.other_stream = get_stream("Denmark", unsubscribed_user.realm)@@ -1855,6 +1861,12 @@ class MessageAccessTests(ZulipTestCase):filtered_messages = self.assert_bulk_access(unsubscribed_user, message_ids, stream, 4, 1)self.assert_length(filtered_messages, 2)+ # Test public message access for service bot+ service_bot = self.example_user("outgoing_webhook_bot")+ self.subscribe(service_bot, stream_name)+ filtered_messages = self.assert_bulk_access(service_bot, message_ids, stream, 4, 1)+ self.assert_length(filtered_messages, 2)+class PersonalMessagesFlagTest(ZulipTestCase):def test_is_private_flag_not_leaked(self) -> None:diff --git a/zerver/tests/test_message_send.py b/zerver/tests/test_message_send.pyindex 6e75ae7c259..8f3733f3dc4 100644--- a/zerver/tests/test_message_send.py+++ b/zerver/tests/test_message_send.py@@ -1382,13 +1382,6 @@ class StreamMessagesTest(ZulipTestCase):realm = get_realm("zulip")subscribers = self.users_subscribed_to_stream(stream_name, realm)- # Outgoing webhook bots don't store UserMessage rows; they will be processed later.- subscribers = [- subscriber- for subscriber in subscribers- if subscriber.bot_type != UserProfile.OUTGOING_WEBHOOK_BOT- ]-old_subscriber_messages = list(map(message_stream_count, subscribers))non_subscribers = [