Milestone 495 "Email goes to each account, in its own time zone", on the operator's ruling (System 156): notifications go to each user, times in their zone, defaults on, toggled per user or per role. - users.notify_alerts / notify_report (migration 0036): None follows the role's default, notify.<kind>.<role> in settings, all on to start. - mail.pick_recipients: active accounts that want the email and have an address mail can reach (an SSO placeholder like name@oidc is skipped and flagged), each in its own zone with no UTC beside it, then the Also send to addresses in their chosen zone with UTC beside. One copy per address, all over one SMTP connection. - Alerts, the weekly report and the test email (to you, in your zone, plus the typed addresses) send that way. The save-time smtp.tz capture is gone. - Notifications: a role × email table of defaults, who each email reaches and who can't be reached, and Also send to with its own zone, which starts as the first admin's to open the page. - Account page: your address and your two switches. Users: an Emailed column, and an admin sets an account's switches on its page. - The Alerts page counts the accounts it emails. zone_select macro and formatting.zones_by_region shared by Account and Notifications. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
2.1 KiB
HTML
35 lines
2.1 KiB
HTML
{# The email form for one account (milestone 495): its address, and whether
|
||
it gets alert emails and the weekly report. Used by the Account page (your
|
||
own) and an account's page in Settings › Users (an admin's view).
|
||
`defaults` is {kind: bool}, the account's role defaults. #}
|
||
{% macro email_choices(user, defaults, action, error=none, with_address=true) -%}
|
||
<form method="post" action="{{ action }}" class="form-page" id="email">{{ csrf_field() }}
|
||
<section class="card form-section" aria-labelledby="email-title">
|
||
<h2 id="email-title" class="section-title">Email</h2>
|
||
{% if error %}<p class="field-error" role="alert">{{ error }}</p>{% endif %}
|
||
{% if with_address %}
|
||
<div class="field">
|
||
<label class="field-label" for="email-address">Address</label>
|
||
<input class="input" id="email-address" type="email" name="email" maxlength="255" value="{{ user.email }}" required>
|
||
{% if user.auth_source != "local" %}<span class="field-hint">Your sign-in provider set this first; change it if mail doesn't reach it.</span>{% endif %}
|
||
</div>
|
||
{% endif %}
|
||
<div class="form-pair">
|
||
{% for kind, label in (("alerts", "Alert emails"), ("report", "Weekly report")) %}
|
||
{% set choice = user["notify_" ~ kind] %}
|
||
<div class="field">
|
||
<label class="field-label" for="email-{{ kind }}">{{ label }}</label>
|
||
<select class="input" id="email-{{ kind }}" name="notify_{{ kind }}">
|
||
<option value=""{% if choice is none %} selected{% endif %}>As for {{ user.role.value }}s ({{ "on" if defaults[kind] else "off" }})</option>
|
||
<option value="on"{% if choice is sameas true %} selected{% endif %}>On</option>
|
||
<option value="off"{% if choice is sameas false %} selected{% endif %}>Off</option>
|
||
</select>
|
||
</div>
|
||
{% endfor %}
|
||
</div>
|
||
<span class="field-hint">Times in these emails are in {{ user.time_zone or "UTC" }}. A role's default is set in Settings › Notifications.</span>
|
||
<button type="submit" class="btn btn-ghost">Save email settings</button>
|
||
</section>
|
||
</form>
|
||
{%- endmacro %}
|