add more status updates
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
"""Outgoing email -- plan.md §7 (state-transition side effects).
|
||||
|
||||
Three public functions, one per dedicated template:
|
||||
Five public functions, one per dedicated template:
|
||||
|
||||
send_confirmation_email(submission)
|
||||
Guest path: token-link emailed immediately after `SubmitView` creates
|
||||
@@ -20,7 +20,19 @@ Three public functions, one per dedicated template:
|
||||
rejection reason in the email as on the public detail page.
|
||||
Template: `emails/rejected.*`.
|
||||
|
||||
All three delegate to Django's email machinery. The backend is wired in
|
||||
send_printing_email(submission)
|
||||
Fired on any transition into `status = printing` (operator clicks
|
||||
"Start printing" in admin). Excited tone: "your print is on the
|
||||
bed right now". Template: `emails/printing.*`.
|
||||
|
||||
send_completed_email(submission)
|
||||
Fired on any transition into `status = completed` (operator clicks
|
||||
"Mark completed"). Pickup-ready announcement; renders
|
||||
`submission.operator_notes` as a "note from the operator" callout
|
||||
when present (typically pickup instructions). Template:
|
||||
`emails/completed.*`.
|
||||
|
||||
All five delegate to Django's email machinery. The backend is wired in
|
||||
`hamprint/settings/base.py`: Mailtrap via `django-anymail` when
|
||||
`MAILTRAP_API_TOKEN` is present, console when not. Send failures are caught
|
||||
+ logged so a flaky transport never blocks the submission flow.
|
||||
@@ -146,3 +158,20 @@ def send_verifying_email(sub: Submission) -> bool:
|
||||
will be the queued / printing one."""
|
||||
detail_url = f"{settings.SITE_URL}/p/{sub.slug}/"
|
||||
return _send("verifying", sub, {"detail_url": detail_url})
|
||||
|
||||
|
||||
def send_printing_email(sub: Submission) -> bool:
|
||||
"""Notify the submitter that the print has just started (plan.md §7.3
|
||||
`queued -> printing` transition). Excited tone -- the operator just
|
||||
clicked "Start printing" in admin and the first layer is going down."""
|
||||
detail_url = f"{settings.SITE_URL}/p/{sub.slug}/"
|
||||
return _send("printing", sub, {"detail_url": detail_url})
|
||||
|
||||
|
||||
def send_completed_email(sub: Submission) -> bool:
|
||||
"""Notify the submitter that the print finished successfully and is
|
||||
ready for pickup (plan.md §7.3 `printing -> completed` transition).
|
||||
`submission.operator_notes` is rendered when present so any
|
||||
pickup-instruction the operator typed in admin reaches the user."""
|
||||
detail_url = f"{settings.SITE_URL}/p/{sub.slug}/"
|
||||
return _send("completed", sub, {"detail_url": detail_url})
|
||||
|
||||
Reference in New Issue
Block a user