feat(invitations): email the invitee on invite create (PMS-246) #181
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/mapps-246-invite-email"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Closes the delivery gap from PMS-244: invites existed in the API but nobody was notified. Creating an invite now emails the invitee.
How
notificationsrow (channel=email, explicit recipient = the invitee, pre-rendered subject/body) in the same transaction as the invite. The existing dispatcher worker drains it via the SMTP mailer with its retry/backoff - the same path the codebase uses for password-reset / welcome mail. The invitee isn't a Mokosh user yet, so the row carries an explicitrecipient, not auser_id.client_origin) - the invite resolves by verified email on the invitee's next sign-in. No token-accept page in this minimal cut. The body names the tenant + role and states the 14-day expiry.InvitationsService::with_app_url(spa_origin)gates email on a configured SPA URL; the router enables it, existing tests (new(db)) send nothing.On the "no mailer wired" note
The ticket flagged no mailer - but the notifications system already has one (
utils::email::Mailer/SmtpMailer, drained by the dispatcher worker). This reuses it; no new transport needed.Verification
cargo check --all-targets+cargo clippy --all-targetsclean.tests/invitations.rsaddscreate_with_app_url_enqueues_invite_email(email row enqueued with the link when configured; none when unset). Full invitations suite (6) passes.🤖 Generated with Claude Code