-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Header handling #165
Draft
mec
wants to merge
3
commits into
main
Choose a base branch
from
fix/header-handling
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Fix: Header handling #165
Conversation
This file contains 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
Pull Request Test Coverage Report for Build 11403145272Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 11405877090Details
💛 - Coveralls |
mec
force-pushed
the
fix/header-handling
branch
from
October 18, 2024 13:47
99db955
to
dfb2447
Compare
mec
force-pushed
the
fix/header-handling
branch
from
October 18, 2024 14:36
dfb2447
to
a4db21f
Compare
The call to `except` here should not be an array as there is no array of these symbol to exclude from the hash. This issue was kindly identified by @inulty-dfe in #162.
With a view mail we have to call `mail` twice, once to get the body of the email from the view and once again to override the format contents. We were passing in any custom headers for both calls which was resulting in duplicate headers in the message. By calling `mail` without the headers, we can get the body and not modify the headers, leaving that for the second call. Interestingly adding custom headers is pointless, as they will never end up in the email from Notify - we may want to stop messing with the headers at all - I think it is a hangover from the v1 implementation. This was kindly identified by @inulty-dfe in #162 who are testing the header Mail::Fields that are potentially duplicated.
We only keep a Mail::Message for use in previews, it is never actually sent, email sending is handled by Notify, not the host application. The Notify API does not accept additional custom headers, so passing custom headers to the message via the call to `mail` serves no purpose as those headers will never be used (other than in the previews, where they get shown). This work refactors the two mailer methods so that only the `to` and `subject` headers are set on the Mail::Message returned.
mec
force-pushed
the
fix/header-handling
branch
from
October 18, 2024 14:44
a4db21f
to
c628284
Compare
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.
This work sets out to resolve the two issues reported in #162 by @inulty-dfe.
We fix the first issue on the call to
Hash.except
.We then stop the potential for duplicate headers ending up in the Mail::Message, by only sending the headers once to
mail
inview_mail
.After some thought, I wondered why we support headers other than
to
andsubject
as they will never get used as we cannot pass them on to Notify to be actually sent - dfb2447 is a refactor that sidesteps both issues by only setting a to and subject header, which do not appear to be duplicated no matter how many timesmail
is called.This work will form the basis of v2.0.1