feat: add environment prefix to email subjects#3903
feat: add environment prefix to email subjects#3903SylvainChevalier wants to merge 3 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>
|
Feel free to reject if this adds too much complexity or is too hard to maintain or etc. |
|
@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>
|
@claude the integration tests failed, fix the issues. |
|
Claude finished @SylvainChevalier's task in 1m 32s —— View job Test Failures Fixed ✓Todo List:
Summary: Fixed the circular import error that was causing both unit tests and integration tests to fail. Problem:
Solution:
Changes:
The fix has been committed and pushed. The CI tests should now pass. Branch: claude/issue-3899-20251210-1048 | |
Move the User model import from module level to inside the filter_staff_emails function to avoid circular import during Django initialization. This fixes the ImportError that was causing both unit and integration tests to fail. Co-authored-by: Sylvain <SylvainChevalier@users.noreply.github.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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