subject prefix issue#10
Merged
neerajsingh0101 merged 1 commit intomasterfrom Jan 26, 2015
Merged
Conversation
Contributor
|
When/why would this happen? |
Contributor
|
This will happen because the same instance of mail_interceptor object will be used for sending all the mails. So when the first mail is sent value of subject_prefix becomes While sending next email, as same object is again used and we have following logic for subject_prefix def add_env_info_to_subject_prefix
...
_prefix = production? ? subject_prefix : "#{subject_prefix} #{env.upcase}"
self.subject_prefix = "[#{_prefix}]"
...It will evaluate as _prefix = "[MAB TEST] TEST"
self.subject_prefix = "[[MAB TEST] TEST]So when we run interceptor = MailInterceptor::Interceptor.new(options)
ActionMailer::Base.register_interceptor(interceptor) |
Contributor
|
I think we should not mutate subject prefix in def add_subject_prefix message
return if subject_prefix.blank?
message.subject = "[#{env_for_subject_prefix} #{subject_prefix}] #{message.subject}"
end |
neerajsingh0101
pushed a commit
that referenced
this pull request
Jan 26, 2015
Merged
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.
this scenario fails
we need to move add_env_info_to_subject_prefix from https://github.com/bigbinary/mail_interceptor/blob/master/lib/mail_interceptor.rb#L18
to
https://github.com/bigbinary/mail_interceptor/blob/master/lib/mail_interceptor.rb#L13
@neerajdotname