Skip to content

Standardize email plain-text templates and link generation - #2510

Open
ihsaan-ullah wants to merge 1 commit into
developfrom
email_templates
Open

Standardize email plain-text templates and link generation#2510
ihsaan-ullah wants to merge 1 commit into
developfrom
email_templates

Conversation

@ihsaan-ullah

@ihsaan-ullah ihsaan-ullah commented Aug 22, 2026

Copy link
Copy Markdown
Collaborator

Description

  • Add missing plain-text alternative for the account activation email, and send it via EmailMultiAlternatives instead of a plain-text-only EmailMessage.
  • Rewrite 9 .txt templates that were literal copies of their .html counterparts (wrong , raw HTML tags) into proper plain text extending emails/base_email.txt.
  • Replace hardcoded + Sites-framework links with across participation, forum, invite, and account-deletion-notice emails; fix links in the account-deletion admin notice that had no scheme at all.
  • Add get_link_context() in utils/email.py as the single place that builds protocol/domain for email templates, and switch all senders to use it.

A checklist for email testing

Account activation

  • Sign up a new user, confirm the activation email arrives
  • View the email's plain-text version — no raw HTML tags visible
  • View the HTML version — renders with Codabench branding/signature/footer
  • Activation link uses the test server's actual domain and scheme (not production)
  • Clicking the link activates the account successfully

Account deletion request

  • Request account deletion, confirm the email arrives
  • Plain-text version has no raw HTML tags
  • Confirmation link uses the correct test-server domain/scheme
  • Clicking the link completes the deletion flow

Account deletion — admin notice

  • Delete a user who has organizations, owned competitions, participations, submissions, data, tasks, queues, and posts
  • Admin notice email arrives to superuser/staff accounts
  • Plain-text version has no raw HTML tags
  • Every listed link (organizations, competitions, tasks) resolves correctly with the right domain/scheme

Account deletion — confirmed

  • Complete a full deletion, confirm the "successfully removed" email arrives
  • Plain-text version has no raw HTML tags

Competition participation — requested

  • Apply to a competition as a participant (non-auto-approve, non-whitelisted)
  • Participant receives "application sent" email with a working competition link
  • Organizer(s) receive "user applied" email with a working competition link
  • Both plain-text versions have no raw HTML tags

Competition participation — accepted

  • Approve a pending participant (both manual approval and auto-approve/whitelist paths)
  • Participant receives "accepted" email with a working competition link
  • Organizer receives "accepted" email with a working competition link

Competition participation — denied

  • Deny a pending participant
  • Participant receives "denied" email with a working competition link
  • Organizer receives "denied" email with a working competition link

Forum new-post notification

  • Post a new reply in a competition forum thread where another user has forum notifications enabled
  • Notification email arrives with a working thread link (correct domain/scheme)

Organization invite

  • Invite a user to an organization
  • Invite email arrives with a working accept/reject link (correct domain/scheme)
  • Accepting the invite works end-to-end

General

  • Confirm links point at the test server's domain, not production — verify DOMAIN_NAME/EXTERNAL_DOMAIN_NAME env vars on the test server are set correctly
  • Spot-check that no email client (or "view plain text" toggle) shows literal <p>, <a>, <ul> etc. in any of the above

Checklist

  • Code review by me
  • Hand tested by me
  • I'm proud of my work
  • Code review by reviewer
  • Hand tested by reviewer
  • CircleCi tests are passing
  • Ready to merge

- Add missing plain-text alternative for the account activation email,
  and send it via EmailMultiAlternatives instead of a plain-text-only
  EmailMessage.
- Rewrite 9 .txt templates that were literal copies of their .html
  counterparts (wrong , raw HTML tags)
  into proper plain text extending emails/base_email.txt.
- Replace hardcoded  + Sites-framework  links
  with  across participation, forum,
  invite, and account-deletion-notice emails; fix links in the
  account-deletion admin notice that had no scheme at all.
- Add get_link_context() in utils/email.py as the single place that
  builds protocol/domain for email templates, and switch all senders
  to use it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant