Skip to content

Commit

Permalink
[webui][api] mark event.mails_sent=true for events with no subscribers
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrolfe committed Jul 5, 2017
1 parent 2b516b9 commit c928577
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/api/app/jobs/send_event_emails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ class SendEventEmails
def perform
Event::Base.where(mails_sent: false).order(created_at: :asc).limit(1000).each do |event|
subscribers = event.subscribers
next if subscribers.empty?

if subscribers.empty?
event.update_attributes(mails_sent: true)
next
end

create_rss_notifications(event)
EventMailer.event(subscribers, event).deliver_now
event.update_attributes(mails_sent: true)
Expand Down

0 comments on commit c928577

Please sign in to comment.