We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dc4ccd9 commit 78aba89Copy full SHA for 78aba89
1 file changed
packages/hackathon/app/interactions/hackathon/events/publish_interaction.rb
@@ -17,11 +17,15 @@ def execute
17
# Change status to published
18
resource.published!
19
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.")
+ # Only send emails for upcoming events, not past events
+ if resource.upcoming?
+ SendEventEmailsJob.perform_later(resource.id)
+ success(resource)
+ .with_message("#{resource.title} has been published! Emails are being sent to all hackers.")
25
+ else
26
27
+ .with_message("#{resource.title} has been published! (No emails sent for past events)")
28
+ end
29
end
30
31
0 commit comments