Skip to content

[#13635] Add more editable templates into custom-email-template feature#13737

Open
WeeJean wants to merge 47 commits intoTEAMMATES:feature/custom-email-templatesfrom
WeeJean:pr4-email-expansion
Open

[#13635] Add more editable templates into custom-email-template feature#13737
WeeJean wants to merge 47 commits intoTEAMMATES:feature/custom-email-templatesfrom
WeeJean:pr4-email-expansion

Conversation

@WeeJean
Copy link
Copy Markdown
Contributor

@WeeJean WeeJean commented Apr 6, 2026

Part of #13635

Description

This PR completes the end-to-end integration of the Configurable Email Template System. Building on the infrastructure from #3, it migrates all remaining 21 system email templates into the ConfigurableEmailTemplate registry.

By moving away from hardcoded Java constants to a database-first approach, we now allow administrators to safely override any system email at runtime via the Admin UI.


Key Changes

Backend & Migration

  • Full Migration: 21 new templates registered with their
    required placeholder sets, automatically enforced by the existing validation guard.
  • Externalized HTML: Created 9 new standalone HTML templates in src/main/resources/, replacing previously inline-only Java strings.
  • Refactoring & Cleanup: Deleted 7 orphaned string constants and 4 helper methods, replacing imperative logic with a cleaner declarative registry.
  • Instructor Copy Fix: Restored the [Email Copy] subject prefix for co-owner notifications, which was previously bypassed by the new setter.

Infrastructure & Build Fixes

  • Codegen Sync: Added EMAIL_TEMPLATE and EMAIL_TEMPLATES to the ResourceEndpoints Java enum. This fixes the CI build failure where api-const.ts was being regenerated without these keys.
  • Integration Test Fix: Implemented dynamic date anchoring for awaiting.session test data (+30 days) to prevent regressions caused by sessions falling into the past during execution.

Frontend & Linting

  • UI Polish: Updated Jest snapshots for the AdminEmailTemplatesPage and resolved all ESLint violations regarding import ordering and template string literals.

Migrated Templates (22 total)

  • NEW_INSTRUCTOR_ACCOUNT_WELCOME (PR3): Welcome email for new instructor accounts.
  • NEW_ACCOUNT_REQUEST_ACKNOWLEDGEMENT: Sent to instructor after submitting an account request.
  • NEW_ACCOUNT_REQUEST_ADMIN_ALERT: Sent to admin when a new account request arrives.
  • STUDENT_COURSE_JOIN: Student invitation to join a course.
  • INSTRUCTOR_COURSE_JOIN: Instructor invitation to join a course.
  • STUDENT_COURSE_REJOIN_AFTER_GOOGLE_ID_RESET: Student re-join link after Google ID reset.
  • INSTRUCTOR_COURSE_REJOIN_AFTER_GOOGLE_ID_RESET: Instructor re-join link after Google ID reset.
  • USER_COURSE_REGISTER: Confirmation when a user registers for a course.
  • STUDENT_EMAIL_CHANGED: Course summary sent when a student's email is updated.
  • STUDENT_COURSE_LINKS_REGENERATED: New access links sent to student after key regeneration.
  • INSTRUCTOR_COURSE_LINKS_REGENERATED: New access links sent to instructor after key regeneration.
  • LOGIN: Magic-link login email.
  • FEEDBACK_OPENED: Notifies participants when a session opens.
  • FEEDBACK_OPENING_SOON: Reminder sent before a session opens.
  • FEEDBACK_CLOSING_SOON: Reminder sent before a session closes.
  • FEEDBACK_CLOSED: Notifies co-owners when a session closes.
  • FEEDBACK_SESSION_REMINDER: Manual reminder blast to incomplete respondents.
  • FEEDBACK_PUBLISHED: Notifies participants when results are published.
  • FEEDBACK_UNPUBLISHED: Notifies participants when results are unpublished.
  • DEADLINE_EXTENSION_GRANTED: Notifies student of a new deadline extension.
  • DEADLINE_EXTENSION_UPDATED: Notifies student of a change to their extension.
  • DEADLINE_EXTENSION_REVOKED: Notifies student that their extension was removed.

Not Migrated (3)

  • ACCOUNT_REQUEST_REJECTION: Excluded because the subject and body are entirely admin-authored free-form text at call time; there is no fixed template to configure.
  • SESSION_LINKS_RECOVERY: Excluded because the body is assembled procedurally by iterating over a variable number of courses and sessions; no static template structure exists to override.
  • SEVERE_LOGS_COMPILATION: Excluded as an internal ops-only email; the body is machine-generated log lines and the subject embeds the live app version.

@WeeJean WeeJean marked this pull request as draft April 6, 2026 14:32
@WeeJean WeeJean marked this pull request as ready for review April 13, 2026 05:24
@WeeJean WeeJean requested a review from DhiraPT April 13, 2026 05:34
WeeJean and others added 4 commits April 14, 2026 14:23
…ail-expansion

# Conflicts:
#	src/it/java/teammates/it/sqllogic/api/EmailGeneratorTestIT.java
#	src/test/java/teammates/sqlui/webapi/GetActionClassesActionTest.java
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