feat: add environment prefix to email subjects#3903
Open
SylvainChevalier wants to merge 2 commits intomainfrom
Open
feat: add environment prefix to email subjects#3903SylvainChevalier wants to merge 2 commits intomainfrom
SylvainChevalier wants to merge 2 commits intomainfrom
Conversation
Add [dev] or [play] prefix to email subjects when running in dev or play environments to help distinguish them from production emails. Changes: - Modified send_email_with_template() to add prefix based on METACULUS_ENV - Created get_email_subject_with_env_prefix() helper for direct EmailMessage usage - Applied helper to all EmailMessage instances in utils/tasks.py and misc/views.py Fixes #3899 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Sylvain <SylvainChevalier@users.noreply.github.com>
Contributor
Author
|
Feel free to reject if this adds too much complexity or is too hard to maintain or etc. |
Contributor
|
@claude I don't like the solution at all. Implement it globally in one place only -- send_email_async |
|
Claude finished @hlbmtc's task in 5m 3s —— View job Refactoring Complete ✓I've successfully refactored the implementation to centralize all email prefix logic in Changes MadeSingle source of truth in
Cleanup across codebase:
Result: All email prefix logic now lives in one place ( Tests: Verified existing tests only mock Branch: claude/issue-3899-20251210-1048 |
Move all environment prefix logic to a single function in misc/tasks.py: - Created add_env_prefix_to_subject() as the single source of truth - Updated send_email_async() to use this function - Removed duplicate logic from utils/email.py and utils/tasks.py - Updated all EmailMessage instances to use the centralized function This simplifies maintenance by keeping all email prefix logic in one place. Co-authored-by: Hlib <hlbmtc@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add [dev] or [play] prefix to email subjects when running in dev or play environments to help distinguish them from production emails.
Changes
Fixes #3899
Generated with Claude Code