Files
zulip/zerver/lib/scheduled_messages.py
Aman Agrawal c0ef1c360a message_send: Edit scheduled message if its ID is present.
If the ID of the scheduled message is passed by the client, we
edit the existing scheduled message instead of creating a new one.

However, this will soon be moved into its own API endpoint.
2023-04-14 17:38:37 -07:00

14 lines
491 B
Python

from django.utils.translation import gettext as _
from zerver.lib.exceptions import ResourceNotFoundError
from zerver.models import ScheduledMessage, UserProfile
def access_scheduled_message(
user_profile: UserProfile, scheduled_message_id: int
) -> ScheduledMessage:
try:
return ScheduledMessage.objects.get(id=scheduled_message_id, sender=user_profile)
except ScheduledMessage.DoesNotExist:
raise ResourceNotFoundError(_("Scheduled message does not exist"))