Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

reminders: Use acting user permissions when sending reminders.

Pratik Chanda619aebaf9c53
diff --git a/zerver/actions/message_send.py b/zerver/actions/message_send.py
index 53ed6dbf503..5ea55858042 100644
--- a/zerver/actions/message_send.py
+++ b/zerver/actions/message_send.py
@@ -2060,12 +2060,14 @@ def internal_send_private_message(
content: str,
*,
disable_external_notifications: bool = False,
+ acting_user: UserProfile | None = None,
) -> int | None:
message = internal_prep_private_message(
sender,
recipient_user,
content,
disable_external_notifications=disable_external_notifications,
+ acting_user=acting_user,
)
if message is None:
return None
diff --git a/zerver/actions/scheduled_messages.py b/zerver/actions/scheduled_messages.py
index ac57996a06e..877146a847b 100644
--- a/zerver/actions/scheduled_messages.py
+++ b/zerver/actions/scheduled_messages.py
@@ -315,11 +315,13 @@ def send_reminder(scheduled_message: ScheduledMessage) -> None:
# If we no longer have access to the message, we send the reminder with the
# last known message position and content.
content = scheduled_message.content
- # Reminder messages are always sent from the notification bot.
+ # Reminder messages are always sent from the notification bot. We use acting_user
+ # to have appropriate permissions for the messages.
message_id = internal_send_private_message(
get_system_bot(settings.NOTIFICATION_BOT, scheduled_message.realm.id),
current_user,
content,
+ acting_user=current_user,
)
scheduled_message.delivered_message_id = message_id
scheduled_message.delivered = True