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
+8
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 {