Skip to content

Commit

Permalink
Merge pull request #312 from nextcloud/backport/311/fix-restricted-us…
Browse files Browse the repository at this point in the history
…er-for-email-command

[stable14] Correctly restrict affected users when using command to send emails
  • Loading branch information
MorrisJobke authored Nov 13, 2018
2 parents d6d3055 + eb2188d commit ce5ef1c
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 ce5ef1c

Please sign in to comment.