1
0
Fork 0
mirror of synced 2024-10-01 17:58:02 +13:00

Throw if status still scheduled and scheduled time before now

This commit is contained in:
Jake Barnby 2024-01-30 16:33:18 +13:00
parent 770c76b1ad
commit afb32b49d5
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -3297,6 +3297,14 @@ App::delete('/v1/messaging/messages/:messageId')
throw new Exception(Exception::MESSAGE_ALREADY_SCHEDULED);
case MessageStatus::SCHEDULED:
$scheduleId = $message->getAttribute('scheduleId');
$scheduledAt = $message->getAttribute('scheduledAt');
$now = DateTime::now();
$scheduledDate = DateTime::formatTz($scheduledAt);
if ($now > $scheduledDate) {
throw new Exception(Exception::MESSAGE_ALREADY_SCHEDULED);
}
if (!empty($scheduleId)) {
try {