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

Only set schedule active is status is scheduled

This commit is contained in:
Jake Barnby 2024-02-12 16:55:34 +13:00
parent f237e863de
commit 3ba6652be8
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -3141,7 +3141,7 @@ App::patch('/v1/messaging/messages/email/:messageId')
'resourceUpdatedAt' => DateTime::now(),
'projectId' => $project->getId(),
'schedule' => $scheduledAt,
'active' => $status === 'processing',
'active' => $status === MessageStatus::SCHEDULED,
]));
$message->setAttribute('scheduleId', $schedule->getId());
@ -3155,7 +3155,7 @@ App::patch('/v1/messaging/messages/email/:messageId')
$schedule
->setAttribute('resourceUpdatedAt', DateTime::now())
->setAttribute('schedule', $scheduledAt)
->setAttribute('active', $status === 'processing');
->setAttribute('active', $status === MessageStatus::SCHEDULED);
$dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule);
}
@ -3260,7 +3260,7 @@ App::patch('/v1/messaging/messages/sms/:messageId')
'resourceUpdatedAt' => DateTime::now(),
'projectId' => $project->getId(),
'schedule' => $scheduledAt,
'active' => $status === 'processing',
'active' => $status === MessageStatus::SCHEDULED,
]));
$message->setAttribute('scheduleId', $schedule->getId());
@ -3274,7 +3274,7 @@ App::patch('/v1/messaging/messages/sms/:messageId')
$schedule
->setAttribute('resourceUpdatedAt', DateTime::now())
->setAttribute('schedule', $scheduledAt)
->setAttribute('active', $status === 'processing');
->setAttribute('active', $status === MessageStatus::SCHEDULED);
$dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule);
}
@ -3284,7 +3284,7 @@ App::patch('/v1/messaging/messages/sms/:messageId')
$message = $dbForProject->updateDocument('messages', $message->getId(), $message);
if ($status === 'processing' && \is_null($message->getAttribute('scheduledAt'))) {
if ($status === MessageStatus::PROCESSING) {
$queueForMessaging
->setMessageId($message->getId())
->trigger();
@ -3419,7 +3419,7 @@ App::patch('/v1/messaging/messages/push/:messageId')
'resourceUpdatedAt' => DateTime::now(),
'projectId' => $project->getId(),
'schedule' => $scheduledAt,
'active' => $status === 'processing',
'active' => $status === MessageStatus::SCHEDULED,
]));
$message->setAttribute('scheduleId', $schedule->getId());
@ -3433,7 +3433,7 @@ App::patch('/v1/messaging/messages/push/:messageId')
$schedule
->setAttribute('resourceUpdatedAt', DateTime::now())
->setAttribute('schedule', $scheduledAt)
->setAttribute('active', $status === 'processing');
->setAttribute('active', $status === MessageStatus::SCHEDULED);
$dbForConsole->updateDocument('schedules', $schedule->getId(), $schedule);
}
@ -3443,7 +3443,7 @@ App::patch('/v1/messaging/messages/push/:messageId')
$message = $dbForProject->updateDocument('messages', $message->getId(), $message);
if ($status === 'processing' && \is_null($message->getAttribute('scheduledAt'))) {
if ($status === MessageStatus::PROCESSING) {
$queueForMessaging
->setMessageId($message->getId())
->trigger();