worker: Flag messages processed by embedded bot.

This commit updates embedded bots to mark messages they have process as
read. Since the service bots have their own `UserMessage` rows, this
change enables us to track whether the bot has in fact processed the
message by adding the `read` flag to their `UserMessage`.

Fixes #28869.
This commit is contained in:
PieterCK
2024-11-22 15:25:20 +07:00
committed by Tim Abbott
parent cacd6bb88c
commit a995510f0c
2 changed files with 11 additions and 6 deletions

View File

@@ -608,13 +608,12 @@ class TestServiceBotEventTriggers(ZulipTestCase):
self.assertFalse(mock_queue_event_on_commit.called)
@responses.activate
def test_flag_messages_outgoing_webhook_bot_has_processed(self) -> None:
@for_all_bot_types
def test_flag_messages_service_bots_has_processed(self) -> None:
"""
Verifies that once an event has been processed by the outgoing webhook
bot's queue processor, the message is marked as processed (flagged with `read`).
Verifies that once an event has been processed by the service bot's
queue processor, the message is marked as processed (flagged with `read`).
"""
self.bot_profile.bot_type = UserProfile.OUTGOING_WEBHOOK_BOT
self.bot_profile.save()
sender = self.user_profile
recipients = [self.user_profile, self.bot_profile, self.second_bot_profile]
responses.add(