Private
Public Access
Style outgoing emails instead of plain text (#68)
Every email went through one shared plain-text-only path. Redesigned send_email/send_test_email around structured paragraphs + an optional CTA button instead of one pre-formatted string, and render both a proper styled HTML card (table-based, inline styles -- email clients strip <style> blocks and don't support CSS variables) and a clean plain-text fallback from the same input, sent as multipart/alternative. The HTML is themed per recipient: an email to an existing user renders in their own selected theme (dark/light/midnight/sunset, or their saved custom palette), resolved server-side from User.theme/ active_custom_theme_id. Site invites have no account yet to read a theme from, so they use the default DarkSingularity palette. All five existing email triggers (site invite, room-added, password reset, #66's DM notification, admin test email) updated to the new call shape. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -40,13 +40,19 @@ async def create_site_invite(
|
||||
await db.refresh(invite)
|
||||
|
||||
signup_link = f"{base_url.rstrip('/')}/signup?token={raw_token}"
|
||||
# No theme_user -- the invitee doesn't have an account yet, so there's
|
||||
# no theme of theirs to use (#68). Default palette, same as any
|
||||
# logged-out page.
|
||||
await send_email(
|
||||
db,
|
||||
email,
|
||||
"You're invited to join DS Chat",
|
||||
f"You've been invited to join DS Chat by {actor.username}.\n\n"
|
||||
f"Set up your account here:\n{signup_link}\n\n"
|
||||
f"This link expires in 7 days.",
|
||||
[
|
||||
f"You've been invited to join DS Chat by {actor.username}.",
|
||||
"This link expires in 7 days.",
|
||||
],
|
||||
cta_label="Set up your account",
|
||||
cta_url=signup_link,
|
||||
)
|
||||
return invite
|
||||
|
||||
|
||||
Reference in New Issue
Block a user