Adds logic to send proposal notifications in batches
WIP batches tests
This commit is contained in:
@@ -14,9 +14,11 @@ class EmailDigest
|
||||
notifications.any?
|
||||
end
|
||||
|
||||
def deliver
|
||||
if pending_notifications?
|
||||
Mailer.proposal_notification_digest(user, notifications.to_a).deliver_later
|
||||
|
||||
def deliver(run_at)
|
||||
if valid_email? && pending_notifications?
|
||||
Mailer.delay(run_at: run_at).proposal_notification_digest(user, notifications.to_a)
|
||||
mark_as_emailed
|
||||
end
|
||||
end
|
||||
|
||||
@@ -25,4 +27,8 @@ class EmailDigest
|
||||
user.update(failed_email_digests_count: 0)
|
||||
end
|
||||
|
||||
def valid_email?
|
||||
user.email.match(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user