mirror of
https://github.com/zulip/zulip.git
synced 2025-11-16 11:52:01 +00:00
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.
14 lines
491 B
Python
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"))
|