Skip to content

Commit 78aba89

Browse files
don't send emails for past events
1 parent dc4ccd9 commit 78aba89

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

packages/hackathon/app/interactions/hackathon/events/publish_interaction.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,15 @@ def execute
1717
# Change status to published
1818
resource.published!
1919

20-
# Queue background job to send emails to all hackers
21-
SendEventEmailsJob.perform_later(resource.id)
22-
23-
success(resource)
24-
.with_message("#{resource.title} has been published! Emails are being sent to all hackers.")
20+
# Only send emails for upcoming events, not past events
21+
if resource.upcoming?
22+
SendEventEmailsJob.perform_later(resource.id)
23+
success(resource)
24+
.with_message("#{resource.title} has been published! Emails are being sent to all hackers.")
25+
else
26+
success(resource)
27+
.with_message("#{resource.title} has been published! (No emails sent for past events)")
28+
end
2529
end
2630
end
2731
end

0 commit comments

Comments
 (0)