Skip to content

Send email to activity creator on event creation#681

Closed
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-no-email-activity-creator
Closed

Send email to activity creator on event creation#681
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-no-email-activity-creator

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Event creators never received the new-event notification email — they were only included in the bulk send if they happened to be intern scope users with new_event_mail: true.

Changes

  • app/models/event.rbsend_new_event_email now unconditionally notifies the creator first, then excludes them from the bulk intern query to prevent duplicates. Creator is notified even for attendance: true (dispuutsborrel) events.
def send_new_event_email
  # Always notify the creator of the event
  UserMailer.mail_new_event(self.user, self).deliver

  # Send to all leden with new_event_mail enabled, excluding the creator
  if self.usergroup_id.nil?
    unless self.attendance
      User.intern.where(new_event_mail: true).where.not(id: self.user_id).each { ... }
    end
  else
    self.usergroup.users.where(new_event_mail: true).where.not(id: self.user_id).each { ... }
  end
end
  • app/models/user.rb — Fixed typo: virtual attribute declared as new_event_email but DB column (and all query/form references) use new_event_mail.

  • test/models/event_test.rb — Added tests: creator always receives email, creator receives email on attendance events, no duplicate emails when creator also has new_event_mail: true.

- Always notify the event creator when they create an event, regardless
  of their new_event_mail preference
- Exclude the creator from the bulk intern notification to avoid
  duplicate emails when creator has new_event_mail enabled
- Fix typo in User model: new_event_email virtual attribute corrected
  to new_event_mail to match the actual DB column name
- Add tests covering creator email, attendance events, and no duplicates

Agent-Logs-Url: https://github.com/DispuutHamers/webapp/sessions/803e8800-4b24-4eb5-a838-36935180ee0b

Co-authored-by: koenjdejong <74268574+koenjdejong@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix no email notification when activity is created for creator Send email to activity creator on event creation Apr 2, 2026
Copilot AI requested a review from koenjdejong April 2, 2026 13:20
@koenjdejong
Copy link
Copy Markdown
Member

Superceded by #683

@koenjdejong koenjdejong closed this Apr 2, 2026
@dexbleeker dexbleeker deleted the copilot/fix-no-email-activity-creator branch May 5, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No email when activity is created for creator

2 participants