Repository navigation
Fix GradeChangeRequest sender address missing email - #6141
Merged
willgearty merged 2 commits intoOct 20, 2026
Merged
willgearty merged 2 commits into
willgearty merged 2 commits into
Conversation
…ed#6139) Signed-off-by: Shresth Juyal <shresthajuyal96@gmail.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The sender-address fix is covered by a focused regression test, with no unresolved blocking issues.
No open issues 🎉
What changed in this PR
Fixes grade-change confirmation emails so the configured group name includes a valid sender address.
Changes:
- Corrects
from_emailconstruction. - Adds regression coverage for configured
full_group_name.
| File | Description |
|---|---|
esp/esp/users/tests.py |
Verifies the corrected sender format. |
esp/esp/users/models/__init__.py |
Corrects sender address construction. |
Review effort: Lite
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.
Description
GradeChangeRequest.send_confirmation_email()constructed thefrom_emailargument using anorexpression followed by string concatenation:In Python, the
+operator has higher precedence thanor. Consequently, whenfull_group_nameis set, the expression evaluates to the group name alone, without the sender's email address.The project's
send_mailvalidator rejects this value withInvalid 'From' email address, preventing the grade change confirmation email from being sent.This PR fixes the issue by computing the display name and sender address separately, ensuring that the email address is always included:
Changes Made
esp/esp/users/models/__init__.py: Separate the sender display name from the completefrom_emailaddress and pass the correctly formatted sender tosend_mail. The subject, message, and recipient remain unchanged.esp/esp/users/tests.py: Addtest_confirmation_email_sender_with_full_group_nameto verify that whenfull_group_nameis configured, the sender address is correctly formatted asMIT Educational Studies Program <info@{SITE_INFO[1]}>.Related Issue
Closes #6139
Type of Change
Testing
Test results:
esp/esp/users/tests.py: 117 passed, 0 failed, including the new regression test.ESPError_Log: Invalid 'From' email address (MIT Educational Studies Program).flake8reports no warnings in either changed file.Verification scope: The regression was verified locally using the failing and passing test cases. A live email was not sent from a deployed instance.
AI Disclosure
AI was used to review the codebase and test coverage. Implementation, testing, and debugging were done manually.
Checklist