-
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.
prototype (#558) attempt to seed the specs (#558) remove fixtures for customcontent (#558) send email and fix specs (#558) new spec for participation rejection job (#558) fix specs, rollback state (#558) move job test spec to course_spec (#558)
- Loading branch information
Showing
13 changed files
with
219 additions
and
237 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,31 @@ | ||
# 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::ParticipationRejectionJob < BaseJob | ||
self.parameters = [:participation_id] | ||
|
||
def initialize(participation) | ||
super() | ||
@participation_id = participation.id | ||
end | ||
|
||
def perform | ||
return unless participation # may have been deleted again | ||
|
||
set_locale | ||
send_rejection | ||
end | ||
|
||
private | ||
|
||
def send_rejection | ||
Event::ParticipationMailer.reject(participation).deliver_now | ||
end | ||
|
||
def participation | ||
@participation ||= Event::Participation.find_by(id: @participation_id) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# 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. | ||
|
||
module SacCas::Event::ParticipationMailer | ||
extend ActiveSupport::Concern | ||
|
||
CONTENT_REJECTED_PARTICIPATION = 'event_participation_rejected' | ||
|
||
def reject(participation) | ||
@participation = participation | ||
person = @participation.person | ||
|
||
compose(person, CONTENT_REJECTED_PARTICIPATION) | ||
end | ||
|
||
private | ||
|
||
def placeholder_event_name | ||
@participation.event.to_s | ||
end | ||
|
||
def placeholder_recipient_name_with_salutation | ||
@participation.person.salutation_value | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# 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. | ||
|
||
CustomContent.seed_once(:key, | ||
{ key: Event::ParticipationMailer::CONTENT_REJECTED_PARTICIPATION, # 'event_participation_rejected` | ||
placeholders_required: 'participant-name', | ||
placeholders_optional: 'event-name, application-url, event-details' }) | ||
|
||
participation_rejected_id = | ||
CustomContent.get(Event::ParticipationMailer::CONTENT_REJECTED_PARTICIPATION).id | ||
|
||
CustomContent::Translation.seed_once(:custom_content_id, :locale, | ||
{ custom_content_id: participation_rejected_id, | ||
locale: 'de', | ||
label: 'Anlass: E-Mail Ablehnung', | ||
subject: 'Kursablehnung', | ||
body: "Hallo {participant-name}<br/><br/>" \ | ||
"Sie wurden leider für den Kurs {event-name} abgelehnt.<br/><br/>" \ | ||
"Siehe {application-url}<br/><br/>" \ | ||
"Kursdetails:<br/>{event-details}<br/>" }, | ||
|
||
{ custom_content_id: participation_rejected_id, | ||
locale: 'fr', | ||
label: "Événement: E-Mail de refus" }, | ||
|
||
{ custom_content_id: participation_rejected_id, | ||
locale: 'en', | ||
label: 'Event: Rejection email' }, | ||
|
||
{ custom_content_id: participation_rejected_id, | ||
locale: 'it', | ||
label: "Evento: E-mail della notifica della rifiuto" } | ||
) |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.