Nur Vorstandsadresse als Kontakt bei Kursen und Anlässen, Version 0.4.1 🤖
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
26ce1112bf
commit
f301d72572
9 changed files with 190 additions and 1 deletions
|
|
@ -1,5 +1,10 @@
|
|||
# hitobito_kjv Changelog
|
||||
|
||||
## 0.4.1
|
||||
|
||||
- E-Mail-Kategorie „Vorstand“; bei Kursen und Anlässen ist von der Kontaktperson nur noch
|
||||
die Vorstandsadresse sichtbar (Kursseite, Kalender-Feed, Teilnahmebestätigung, Mails)
|
||||
|
||||
## 0.4.0
|
||||
|
||||
- Gruppen- und Rollenstruktur nach Satzung 2024: Vorstand mit Vorsitzendem, Stellvertreter,
|
||||
|
|
|
|||
15
README.md
15
README.md
|
|
@ -55,6 +55,18 @@ Rollentypen definiert dieser Wagon (`app/models/group/`, `app/models/role/`);
|
|||
(Präsident → Vorsitzender, Kassier → Schatzmeister, Aktivmitglied → Verbandsmitglied,
|
||||
Vorstandsmitglied/Sekretär → Vorstandsmitglied) und die Sortiertabellen neu befüllt.
|
||||
|
||||
## Vorstandsadresse bei Kursen und Anlässen
|
||||
|
||||
Bei Kursen und Anlässen ist von der Kontaktperson öffentlich nur ihre **Vorstandsadresse**
|
||||
sichtbar: eine weitere E-Mail mit der Kategorie „Vorstand“ (Profil bearbeiten → Weitere
|
||||
E-Mails → Kategorie „Vorstand“, je Person höchstens eine). Die private Haupt-E-Mail und
|
||||
andere weitere E-Mails erscheinen dort nicht. Hat die Kontaktperson keine Vorstandsadresse,
|
||||
wird keine E-Mail angezeigt.
|
||||
|
||||
Das gilt für Kursseite und externe Anmeldung, den öffentlichen Kalender-Feed (ICS), die
|
||||
Teilnahmebestätigung (PDF), die Bestätigungs-Mails an Teilnehmende und die Antwortadresse
|
||||
(falls `event.use_contact_as_reply_to` aktiv ist). Zentrale Stelle: `Kjv::VorstandEmail`.
|
||||
|
||||
## Beitragsstatus und Mitgliedsausweis
|
||||
|
||||
### Gültigkeit und Beitrag
|
||||
|
|
@ -245,6 +257,9 @@ Diese Stellen hängen an Interna des Cores und sollten bei Updates geprüft werd
|
|||
- `Kjv::PeopleHelper#sortable_grouped_person_attr`, `Kjv::CsvImportHelper`,
|
||||
`Kjv::CsvImportsController#field_mappings` und `Kjv::PersonFilterList` überschreiben
|
||||
Core-Methoden.
|
||||
- Vorstandsadresse: `Kjv::EventDecorator#contact_emails` sowie die Kopien in
|
||||
`Kjv::EventContactEmail` (ICS-Beschreibung, Teilnahmebestätigung, Mail-Anlassangaben,
|
||||
Antwortadresse) überschreiben Core-Methoden; bei Updates mit dem Original abgleichen.
|
||||
- Mitgliedsausweis: kommt aus `hitobito_verifiable_pass`, das am Pass-System des Cores hängt.
|
||||
Bei Updates von Core oder diesem Wagon Prüfseite, „Mein Ausweis“ und Sammel-PDF kurz
|
||||
testen. Neue Commits von `hitobito_verifiable_pass` in `VERSIONS` eintragen.
|
||||
|
|
|
|||
17
app/decorators/kjv/event_decorator.rb
Normal file
17
app/decorators/kjv/event_decorator.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Copyright (c) 2026, Kreisjagdverband Bautzen e.V. This file is part of
|
||||
# hitobito_kjv and licensed under the Affero General Public License version 3
|
||||
# or later. See the COPYING file at the top-level directory.
|
||||
|
||||
# Kontaktperson bei Kursen und Anlässen: nur die Vorstandsadresse anzeigen, nicht die
|
||||
# private Haupt-E-Mail und keine weiteren E-Mails (siehe Kjv::VorstandEmail).
|
||||
module Kjv::EventDecorator
|
||||
def contact_emails(icons: true)
|
||||
email = Kjv::VorstandEmail.for(contact)
|
||||
return if email.blank?
|
||||
|
||||
icon = icons ? h.icon(:envelope, class: "me-1") : nil
|
||||
h.content_tag(:p, h.safe_join([icon, h.mail_to(email)].compact, " "))
|
||||
end
|
||||
end
|
||||
76
app/domain/kjv/event_contact_email.rb
Normal file
76
app/domain/kjv/event_contact_email.rb
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Copyright (c) 2026, Kreisjagdverband Bautzen e.V. This file is part of
|
||||
# hitobito_kjv and licensed under the Affero General Public License version 3
|
||||
# or later. See the COPYING file at the top-level directory.
|
||||
|
||||
# Weitere Stellen, an denen der Core die E-Mail der Kontaktperson eines Anlasses ausgibt.
|
||||
# Überall wird die Vorstandsadresse statt der privaten Haupt-E-Mail verwendet.
|
||||
# Die Methoden sind Kopien der Core-Methoden mit ausgetauschter E-Mail; bei Core-Updates
|
||||
# mit dem Original abgleichen.
|
||||
module Kjv::EventContactEmail
|
||||
# Export::Ics::Events: Beschreibung im (öffentlichen) Kalender-Feed
|
||||
module IcsEvents
|
||||
def event_description(event)
|
||||
return event.description unless event.contact
|
||||
|
||||
[
|
||||
event.description, "",
|
||||
event.contact.person_name,
|
||||
event.contact.phone_numbers.map { |pn| "#{pn.label}: #{pn.number}" if pn.public },
|
||||
Kjv::VorstandEmail.for(event.contact), "",
|
||||
url(event)
|
||||
].flatten.compact.join("\n")
|
||||
end
|
||||
end
|
||||
|
||||
# Export::Pdf::Participation::Confirmation: Teilnahmebestätigung
|
||||
module ParticipationConfirmation
|
||||
def render_contact_address
|
||||
text(I18n.t("event.applied_to"), style: :bold)
|
||||
|
||||
email = Kjv::VorstandEmail.for(contact)
|
||||
pdf.bounding_box([10, cursor], width: bounds.width) do
|
||||
if email
|
||||
text(I18n.t("contactable.address_or_email", address: contact_address, email: email))
|
||||
else
|
||||
text(contact_address)
|
||||
end
|
||||
end
|
||||
move_down_line
|
||||
end
|
||||
end
|
||||
|
||||
# Event::ParticipationMailer: Anlass-Angaben in Mails an Teilnehmende
|
||||
module ParticipationMailer
|
||||
def event_details # rubocop:disable Metrics/MethodLength,Metrics/AbcSize
|
||||
infos = []
|
||||
infos << event.name
|
||||
infos << labeled(:dates) { join_lines(event.dates.map(&:to_s)) }
|
||||
infos << labeled(:motto)
|
||||
infos << labeled(:cost)
|
||||
infos << labeled(:description) { convert_newlines_to_breaks(event.description) }
|
||||
infos << labeled(:location) { convert_newlines_to_breaks(event.location) }
|
||||
infos << labeled(:contact) do
|
||||
email = Kjv::VorstandEmail.for(event.contact)
|
||||
email ? escape_html(event.contact) + br_tag + email : escape_html(event.contact)
|
||||
end
|
||||
infos << answers_details
|
||||
infos << additional_information_details
|
||||
infos << placeholder_participation_details
|
||||
join_lines(infos.compact, br_tag * 2)
|
||||
end
|
||||
end
|
||||
|
||||
# Event::ReplyToContact: Antwortadresse (nur wenn event.use_contact_as_reply_to aktiv)
|
||||
module ReplyToContact
|
||||
private
|
||||
|
||||
def set_reply_to_from_event_contact
|
||||
return unless Settings.event.use_contact_as_reply_to
|
||||
|
||||
email = Kjv::VorstandEmail.for(event&.contact)
|
||||
message.reply_to = email if email
|
||||
end
|
||||
end
|
||||
end
|
||||
40
app/domain/kjv/vorstand_email.rb
Normal file
40
app/domain/kjv/vorstand_email.rb
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Copyright (c) 2026, Kreisjagdverband Bautzen e.V. This file is part of
|
||||
# hitobito_kjv and licensed under the Affero General Public License version 3
|
||||
# or later. See the COPYING file at the top-level directory.
|
||||
|
||||
# Öffentliche Vorstandsadresse einer Person: weitere E-Mail mit der Kategorie "Vorstand".
|
||||
#
|
||||
# Bei Kursen und Anlässen wird für die Kontaktperson ausschließlich diese Adresse
|
||||
# angezeigt bzw. weitergegeben (Kursseite, externe Anmeldung, Kalender-Feed,
|
||||
# Teilnahmebestätigung, Mails). Die private Haupt-E-Mail bleibt verborgen. Hat die
|
||||
# Kontaktperson keine Vorstandsadresse, erscheint keine E-Mail.
|
||||
module Kjv::VorstandEmail
|
||||
CATEGORY_KEY = "vorstand"
|
||||
|
||||
module_function
|
||||
|
||||
def for(person)
|
||||
return if person.nil?
|
||||
|
||||
person = person.object if person.respond_to?(:object) # Decorator
|
||||
person.additional_emails.includes(:category)
|
||||
.find { |email| email.category&.key == CATEGORY_KEY }&.email.presence
|
||||
end
|
||||
|
||||
# Für Migration und Seed
|
||||
def ensure_category!
|
||||
ContactAccountCategory.find_or_create_by!(
|
||||
key: CATEGORY_KEY,
|
||||
contact_account_type: AdditionalEmail.sti_name,
|
||||
contactable_type: Person.sti_name
|
||||
) do |category|
|
||||
category.name = "Vorstand"
|
||||
category.unique_per_contactable = true
|
||||
category.position = ContactAccountCategory
|
||||
.where(contact_account_type: AdditionalEmail.sti_name, contactable_type: Person.sti_name)
|
||||
.maximum(:position).to_i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
21
db/migrate/20261009170000_add_vorstand_email_category.rb
Normal file
21
db/migrate/20261009170000_add_vorstand_email_category.rb
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Copyright (c) 2026, Kreisjagdverband Bautzen e.V. This file is part of
|
||||
# hitobito_kjv and licensed under the Affero General Public License version 3
|
||||
# or later. See the COPYING file at the top-level directory.
|
||||
|
||||
# Kategorie "Vorstand" für weitere E-Mails (öffentliche Vorstandsadresse, siehe
|
||||
# Kjv::VorstandEmail). Nur in bestehenden Installationen; bei einer neuen Installation
|
||||
# legt sie der Seed nach den Core-Kategorien an (der Core-Seeder läuft nur, solange noch
|
||||
# keine Kategorie existiert).
|
||||
class AddVorstandEmailCategory < ActiveRecord::Migration[8.0]
|
||||
def up
|
||||
return unless ContactAccountCategory.exists?
|
||||
|
||||
Kjv::VorstandEmail.ensure_category!
|
||||
end
|
||||
|
||||
def down
|
||||
# Kategorie bleibt bestehen, damit zugeordnete Adressen nicht ihre Kategorie verlieren
|
||||
end
|
||||
end
|
||||
8
db/seeds/vorstand_email_category.rb
Normal file
8
db/seeds/vorstand_email_category.rb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Copyright (c) 2026, Kreisjagdverband Bautzen e.V. This file is part of
|
||||
# hitobito_kjv and licensed under the Affero General Public License version 3
|
||||
# or later. See the COPYING file at the top-level directory.
|
||||
|
||||
# Kategorie "Vorstand" für weitere E-Mails (siehe Kjv::VorstandEmail)
|
||||
Kjv::VorstandEmail.ensure_category! if ContactAccountCategory.exists?
|
||||
|
|
@ -5,5 +5,5 @@
|
|||
# or later. See the COPYING file at the top-level directory.
|
||||
|
||||
module HitobitoKjv
|
||||
VERSION = "0.4.0"
|
||||
VERSION = "0.4.1"
|
||||
end
|
||||
|
|
|
|||
|
|
@ -45,6 +45,13 @@ module HitobitoKjv
|
|||
StandardFormBuilder.prepend Kjv::StandardFormBuilder
|
||||
CsvImportHelper.prepend Kjv::CsvImportHelper
|
||||
PeopleHelper.prepend Kjv::PeopleHelper
|
||||
EventDecorator.prepend Kjv::EventDecorator
|
||||
|
||||
### Kontaktperson bei Anlässen: nur Vorstandsadresse (Kjv::VorstandEmail)
|
||||
Export::Ics::Events.prepend Kjv::EventContactEmail::IcsEvents
|
||||
Export::Pdf::Participation::Confirmation.prepend Kjv::EventContactEmail::ParticipationConfirmation
|
||||
Event::ParticipationMailer.prepend Kjv::EventContactEmail::ParticipationMailer
|
||||
Event::ReplyToContact.prepend Kjv::EventContactEmail::ReplyToContact
|
||||
|
||||
### domain
|
||||
Export::Tabular::People::PeopleAddress.prepend Kjv::Export::Tabular::People::PeopleAddress
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue