[FEATURE]: Admission and rejection emails #668

Closed
opened 2026-11-13 12:02:23 +01:00 by simon · 1 comment
Owner

Description

Applicants hear nothing after approval or rejection; the board writes each mail by hand. For some clubs the admission only becomes effective with the board's written consent, so the admission mail has a legal role, and the club needs to know it was sent. This is the first slice of the mail foundation of milestone 88: build it so 88 can extend templates and the sending log.

Proposal

  • On approval: admission mail with admission date, fee type and amount, due date and a club-editable paragraph (e.g. pre-notification of the direct debit date).
  • On rejection: neutral rejection mail without a reason (statutes allow rejection without reasons), with a club-editable paragraph.
  • Both on by default, including for existing installations, and switchable in the settings; the settings page points this out directly.
  • The request records when each mail was sent (shown to reviewers).
  • The language of the mail is the applicant's (stored on the join request at submission), not the reviewer's.

Acceptance criteria

  • Approval sends the admission mail with the stated content; rejection sends the rejection mail.
  • Switching a mail off in the settings stops it; the reviewer sees "not sent (switched off)".
  • Sent time is stored and shown on the request.
  • Mail language follows the applicant's language.
  • Club paragraphs are editable and appear in the mails.

Dependencies

  • None.
## Description Applicants hear nothing after approval or rejection; the board writes each mail by hand. For some clubs the admission only becomes effective with the board's written consent, so the admission mail has a legal role, and the club needs to know it was sent. This is the first slice of the mail foundation of milestone 88: build it so 88 can extend templates and the sending log. ## Proposal - On approval: admission mail with admission date, fee type and amount, due date and a club-editable paragraph (e.g. pre-notification of the direct debit date). - On rejection: neutral rejection mail without a reason (statutes allow rejection without reasons), with a club-editable paragraph. - Both on by default, including for existing installations, and switchable in the settings; the settings page points this out directly. - The request records when each mail was sent (shown to reviewers). - The language of the mail is the applicant's (stored on the join request at submission), not the reviewer's. ## Acceptance criteria - [ ] Approval sends the admission mail with the stated content; rejection sends the rejection mail. - [ ] Switching a mail off in the settings stops it; the reviewer sees "not sent (switched off)". - [ ] Sent time is stored and shown on the request. - [ ] Mail language follows the applicant's language. - [ ] Club paragraphs are editable and appear in the mails. ## Dependencies - None.
Author
Owner

Scope addition (folded in from a separate finding):

Approval side effects must run only after the approval commits. Mv.Membership.JoinFlow.approve_join_request/2 creates the member inside one Ash.transact (lib/mv/membership/join_flow.ex:381-407). The member's after_transaction hooks therefore run before the commit:

  • Mv.Vereinfacht.Changes.SyncContact starts a background SyncTask that re-reads the member on its own connection; before the commit it finds nothing and silently skips the sync. Whether an approved member reaches Vereinfacht depends on a race.
  • The log shows "after_transaction hooks on Mv.Membership.Member.create_member are being executed, but there is an ongoing transaction".

The admission mail of this issue has the same trap: sent inside the transaction, it can go out although the approval rolls back.

Proposal: create the member in the approval with a context that skips the hook's own start (e.g. vereinfacht_sync: :after_commit), and start the Vereinfacht sync and the admission mail only once Ash.transact returned {:ok, _}. Check other callers that create or update members inside a surrounding transaction (CSV import uses :inline).

Additional acceptance criteria:

  • Approving with Vereinfacht configured syncs the new member every time; a test fails when the sync runs before the commit.
  • The admission mail is sent only after the approval committed; a rolled-back approval sends no mail.
  • The after_transaction warning no longer appears for an approval; fee cycles are still generated on approval.
Scope addition (folded in from a separate finding): **Approval side effects must run only after the approval commits.** `Mv.Membership.JoinFlow.approve_join_request/2` creates the member inside one `Ash.transact` (`lib/mv/membership/join_flow.ex:381-407`). The member's `after_transaction` hooks therefore run before the commit: - `Mv.Vereinfacht.Changes.SyncContact` starts a background `SyncTask` that re-reads the member on its own connection; before the commit it finds nothing and silently skips the sync. Whether an approved member reaches Vereinfacht depends on a race. - The log shows "`after_transaction` hooks on `Mv.Membership.Member.create_member` are being executed, but there is an ongoing transaction". The admission mail of this issue has the same trap: sent inside the transaction, it can go out although the approval rolls back. Proposal: create the member in the approval with a context that skips the hook's own start (e.g. `vereinfacht_sync: :after_commit`), and start the Vereinfacht sync and the admission mail only once `Ash.transact` returned `{:ok, _}`. Check other callers that create or update members inside a surrounding transaction (CSV import uses `:inline`). Additional acceptance criteria: - [ ] Approving with Vereinfacht configured syncs the new member every time; a test fails when the sync runs before the commit. - [ ] The admission mail is sent only after the approval committed; a rolled-back approval sends no mail. - [ ] The `after_transaction` warning no longer appears for an approval; fee cycles are still generated on approval.
simon closed this issue 2026-11-17 19:20:42 +01:00
Sign in to join this conversation.
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
local-it/mitgliederverwaltung#668
No description provided.