diff options
author | Joas Schilling <coding@schilljs.com> | 2022-08-26 08:48:06 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-08-26 09:50:58 +0300 |
commit | 417f15761e9d2f0b44f5b0c87ac98e79ef6b4f2a (patch) | |
tree | c7defb0ec7c5bf6a7b98870a4607300d83ec7125 | |
parent | b7d822b38d7420a41d62be7017fe20218480bb1a (diff) |
Only update the next_send_time for disabled users when the time was reached
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/MailNotifications.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/MailNotifications.php b/lib/MailNotifications.php index 5f5ea1e..990ec6b 100644 --- a/lib/MailNotifications.php +++ b/lib/MailNotifications.php @@ -144,10 +144,12 @@ class MailNotifications { foreach ($userSettings as $settings) { if (isset($userEnabled[$settings->getUserId()]) && $userEnabled[$settings->getUserId()] === 'false') { // User is disabled, skip sending the email for them - $settings->setNextSendTime( - $settings->getNextSendTime() + $settings->getBatchTime() - ); - $this->settingsMapper->update($settings); + if ($settings->getNextSendTime() <= $sendTime) { + $settings->setNextSendTime( + $sendTime + $settings->getBatchTime() + ); + $this->settingsMapper->update($settings); + } continue; } |