Skip to main content

Module workflow_mail

Module workflow_mail 

Source
Expand description

Workflow notification helpers.

Sends email on every workflow state change so reviewers know when something is waiting on them and submitters know how their submission was handled. Built on top of the framework’s rustango::email::Mailer trait — the host wires a backend (ConsoleMailer, an SMTP one, an SES one); when no mailer is attached, this module is a no-op.

§Notifications

Sent automatically from the page-editor workflow handlers:

  • submit — notify members of the FIRST task’s role
  • approve to next step — notify members of the NEW current task’s role
  • approve to finish — notify the submitter
  • reject — notify the submitter
  • cancel — notify the submitter (idempotent — they may have triggered the cancel themselves)

Failures during send are logged + swallowed; the workflow transition completes regardless. Notifications are “best-effort delivery” — production deployments should layer their own retry/queue between this module and the network.

Functions§

notify_many
Convenience: send to a list of recipients with a shared subject
render_notification
Compose the standard subject + body for a workflow event. Format kept deliberately plain — production deployments can override by replacing the call site with a Tera-rendered body.
role_member_emails
Resolve (username, email) pairs for every member of a role. Used for “notify members of the current task’s role” — the reviewer routing.
role_member_user_ids
User ids of every active member of a role. The notification preference filter operates on user_ids before email resolution so we don’t synthesise fallback addresses for users who have muted the event anyway.
user_email
Resolve the (username, email) pair for a single user.