-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send email when course participation is canceled (#637)
* Add mailer # Conflicts: # db/seeds/custom_contents.rb * Add specs * change event seeder so its faster to test events PR (#1039) --------- Co-authored-by: Andi Idogawa <largo@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
95 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2024, Schweizer Alpen-Club. This file is part of | ||
# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_sac_cas. | ||
|
||
class Event::ParticipationCanceledMailer < ApplicationMailer | ||
include EventMailer | ||
include MultilingualMailer | ||
|
||
CONFIRMATION = "event_participation_canceled" | ||
|
||
def confirmation(participation) | ||
@participation = participation | ||
@course = participation.event | ||
@person = participation.person | ||
headers[:bcc] = @course.groups.first.course_admin_email | ||
locales = @course.language.split("_") | ||
|
||
compose_multilingual(@person, CONFIRMATION, locales) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2024, Schweizer Alpen-Club. This file is part of | ||
# hitobito_sac_cas and licensed under the Affero General Public License version 3 | ||
# or later. See the COPYING file at the top-level directory or at | ||
# https://github.com/hitobito/hitobito_sac_cas. | ||
|
||
require "spec_helper" | ||
|
||
describe Event::ParticipationCanceledMailer do | ||
let(:event) { Fabricate(:sac_open_course) } | ||
let(:participation) { event.participations.create!(person: people(:mitglied)) } | ||
let(:mail) { described_class.confirmation(participation) } | ||
|
||
before { event.groups.first.update!(course_admin_email: "admin@example.com") } | ||
|
||
it "sends to email addresses of participant" do | ||
expect(mail.to).to match_array(["e.hillary@hitobito.example.com"]) | ||
expect(mail.bcc).to match_array(["admin@example.com"]) | ||
expect(mail.body.to_s).to include( | ||
"Hallo Edmund,", | ||
"Deine Abmeldung für den Kurs Eventus (Nummer: #{event.number}) wurde bestätigt." | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters