Throw if status still scheduled and scheduled time before now
This commit is contained in:
parent
770c76b1ad
commit
afb32b49d5
1 changed files with 8 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue