Skip to content
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

Skip delivery notification when perform_deliveries is false. #33824

Merged
merged 2 commits into from Sep 11, 2018

Conversation

@yskkin
Copy link
Contributor

@yskkin yskkin commented Sep 8, 2018

Summary

If perform_deliveries is false, current master logs delivery of mail even if it is not delivered actually.
I think delivery notification should be skipped for this case.

@rails-bot
Copy link

@rails-bot rails-bot commented Sep 8, 2018

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @schneems (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

This repository is being automatically checked for code quality issues using Code Climate. You can see results for this analysis in the PR status below. Newly introduced issues should be fixed before a Pull Request is considered ready to review.

Please see the contribution instructions for more information.

@y-yagi
Copy link
Member

@y-yagi y-yagi commented Sep 8, 2018

This seems the expected behavior. Ref: #32754 (comment)

@eugeneius
Copy link
Member

@eugeneius eugeneius commented Sep 8, 2018

How about logging a different message when delivery is disabled, e.g.

Skipped sending mail to test@email.com as perform_deliveries is false

@y-yagi
Copy link
Member

@y-yagi y-yagi commented Sep 8, 2018

Or how about including perform_deliveries in payload?
This will allow the user to deal with notificaiton when perform_deliveries is false.

@yskkin
Copy link
Contributor Author

@yskkin yskkin commented Sep 9, 2018

I think both of changing message and adding payload is required since user cannot detach LogScbscriber and LogScbscriber cannot know perform_deriveries without adding it to payload.
I'll update PR later unless I missed something.

@yskkin
Copy link
Contributor Author

@yskkin yskkin commented Sep 9, 2018

@y-yagi @eugeneius Thank you for review!
I updated my PR.

@rafaelfranca rafaelfranca merged commit 7acd267 into rails:master Sep 11, 2018
2 checks passed
2 checks passed
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@yskkin yskkin deleted the yskkin:suppress_logging branch Sep 12, 2018
@yskkin
Copy link
Contributor Author

@yskkin yskkin commented Sep 12, 2018

Thanks ❤️

By the way, as I added to the guide, if perform_deliveries is false, AM::Base.deliveries array will not be populated even if delivery_method is :test.

To me, it does not align well with #32754 (comment). Is this bug?

the action of delivering the mail message is still performed and logged so people can for example see what is going to be delivered

@rafaelfranca
Copy link
Member

@rafaelfranca rafaelfranca commented Sep 12, 2018

No. The delivery is not made so we don't want to add the the deliveries array. But we wan to log it specially because in development delivery is disabled by default.

@yskkin
Copy link
Contributor Author

@yskkin yskkin commented Sep 12, 2018

I got it. Thank you for answer!

suketa added a commit to suketa/rails_sandbox that referenced this pull request May 26, 2019
Skip delivery notification when perform_deliveries is false.
rails/rails#33824
@DylanReile
Copy link
Contributor

@DylanReile DylanReile commented Sep 4, 2019

@yskkin @rafaelfranca

In Rails 5 ActionMailer::Base.deliveries was populated by deliver_later, right? Do you know which commit made that change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.