Skip to content

Commit

Permalink
Merge pull request #311 from mlojewski-me/master
Browse files Browse the repository at this point in the history
Correctly restrict affected users when using command to send emails
  • Loading branch information
nickvergessen authored Nov 12, 2018
2 parents 9a7b14a + 0972a93 commit c73cfd2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/MailQueueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,11 @@ protected function getAffectedUsers($limit, $latestSend, $forceSending, $restric

if ($restrictEmails !== null) {
if ($restrictEmails === UserSettings::EMAIL_SEND_HOURLY) {
$query->where($query->expr()->lte('amq_timestamp', $query->createFunction($query->getColumnName('amq_latest_send') . ' + ' . 3600)));
$query->where($query->expr()->eq('amq_timestamp', $query->createFunction($query->getColumnName('amq_latest_send') . ' - ' . 3600)));
} else if ($restrictEmails === UserSettings::EMAIL_SEND_DAILY) {
$query->where($query->expr()->eq('amq_timestamp', $query->createFunction($query->getColumnName('amq_latest_send') . ' + ' . 3600 * 24)));
$query->where($query->expr()->eq('amq_timestamp', $query->createFunction($query->getColumnName('amq_latest_send') . ' - ' . 3600 * 24)));
} else if ($restrictEmails === UserSettings::EMAIL_SEND_WEEKLY) {
$query->where($query->expr()->eq('amq_timestamp', $query->createFunction($query->getColumnName('amq_latest_send') . ' + ' . 3600 * 24 * 7)));
$query->where($query->expr()->eq('amq_timestamp', $query->createFunction($query->getColumnName('amq_latest_send') . ' - ' . 3600 * 24 * 7)));
} else if ($restrictEmails === UserSettings::EMAIL_SEND_ASAP) {
$query->where($query->expr()->eq('amq_timestamp', 'amq_latest_send'));
}
Expand Down

0 comments on commit c73cfd2

Please sign in to comment.