[Refactor:Notifications] Consolidate Email Formatting#11793
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #11793 +/- ##
============================================
- Coverage 20.81% 20.78% -0.04%
+ Complexity 9115 9111 -4
============================================
Files 260 261 +1
Lines 34967 34951 -16
Branches 460 460
============================================
- Hits 7280 7266 -14
+ Misses 27231 27229 -2
Partials 456 456
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Chriun
approved these changes
Jun 24, 2025
Contributor
There was a problem hiding this comment.
Code logic looks sound, functionality works as expected, and unit test passes. Footer is not duplicated in any other places besides send_email.py and is not stored in the database.
However, I had some issues with the Email Status twig page where I was not able to access other pages with emails. I will make an issue on this since it should not be related to this PR.
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.


Why is this Change Important & Necessary?
Our email format, such as the subject and footer, can be found within the web server and the course notification cron job script, which can be troublesome to maintain as we continue to alter their contents. A more maintainable approach would be to normalize the given footer or subject contents before sending them, and not store redundant content in the master database, as they can be implied from the original subject or the potential term and course. Fixes #11734.
What is the New Behavior?
The subject and footer contents are now calculated within the email cron job script and added to the finalized email before being delivered over the network. You can verify the original email content within the master database (
SELECT subject, body FROM emails ORDER by created DESC LIMIT 1;and the finalized email content within the individual logs (/var/local/submitty/logs/emails/mailboxes/<email>/<id>[email protected]).Additionally, this pull request resolves the issue of invalid email error logs displayed on the email status page, which currently shows a site error. The current implementation attempts to access the email error via array access, but it's an email entity; thus, the Doctrine getter method should be used.
Before
After
What steps should a reviewer take to reproduce or test the bug or new feature?
python3 /usr/local/submitty/sbin/send_email.pyusing thesubmitty_daemonuser as many times as needed.UPDATE emails SET error = 'x';and notice the difference in the email status page. Revert the change viaUPDATE emails SET error = '';Automated Testing & Documentation
Email unit tests have been updated to ignore the footer content.
Other information
N/A