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

Pass request params to ActionMailer::Preview #25193

Closed
wants to merge 1 commit into from

Conversation

ixti
Copy link
Contributor

@ixti ixti commented May 30, 2016

Allows passing query params to email previews:

http://localhost:3000/rails/mailers/user_mailer/password_recovery?email=alice@foobar.com

@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @sgrif (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.

Please see the contribution instructions for more information.

@ixti
Copy link
Contributor Author

ixti commented May 30, 2016

This is mostly a discussion starter. So if this is "acceptable" idea, I will add specs for changes.

@prathamesh-sonpatki
Copy link
Member

cc @pixeltrix

There was some interest in having this feature.

@sethherr
Copy link

I'm also very interested in this - essentially a solution to #21702 with @pixeltrix's suggestion.

@ixti - have you written specs for this change?

@ixti ixti force-pushed the improve/action-mailer-preview-params branch 2 times, most recently from 571fbe7 to b88e40b Compare December 18, 2016 13:32
@ixti
Copy link
Contributor Author

ixti commented Dec 18, 2016

@sethherr finally, yes.

@sgrif sorry it took me so long to get back to this PR, but, finally it's ready for review :D

BaseMailerPreview.call(:welcome, params)
end
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure of the worth of this test as it stands - I think it needs breaking out into a separate preview test case file and then actually testing the content of params changes the output. I know that the railties test does that but we should probably have a unit test that does it as well because not everyone runs the railties tests 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you propose to extract that into a separate file? I'm not sure I fully understand your proposal.

@eric1234
Copy link
Contributor

Shouldn't the railties template be updated so that the params are passed into the iframe. Otherwise the body of the message won't get the same params...

https://github.com/rails/rails/blob/master/railties/lib/rails/templates/rails/mailers/email.html.erb#L110

@ixti
Copy link
Contributor Author

ixti commented Dec 27, 2016

@eric1234 Oh. Indeed! Thanks! Will fix that!

@eric1234
Copy link
Contributor

@ixti - Also the dropdown that selects the part being viewed.

@ixti
Copy link
Contributor Author

ixti commented Dec 27, 2016

@eric1234 thanks again. I really completely forgot about views :D

@ixti ixti force-pushed the improve/action-mailer-preview-params branch from b88e40b to 9ee9349 Compare January 22, 2017 13:36
@ixti
Copy link
Contributor Author

ixti commented Jan 22, 2017

@eric1234 fixed view templates and extended test to cover that.
@pixeltrix can you explain your comment, please?
@sgrif review, please.

@ixti ixti force-pushed the improve/action-mailer-preview-params branch from 1113169 to c537f52 Compare February 7, 2017 07:12
@ixti ixti force-pushed the improve/action-mailer-preview-params branch from c537f52 to 28e388a Compare February 7, 2017 07:14
@ixti
Copy link
Contributor Author

ixti commented Feb 7, 2017

@sgrif I have rebased PR upon master. Still waiting for a review. If there's no interest in this PR, please, close it.

@sgrif
Copy link
Contributor

sgrif commented Feb 8, 2017

I'm on parental leave for the next few months. I'll defer to someone else on this.

r? @pixeltrix

@rails-bot rails-bot assigned pixeltrix and unassigned sgrif Feb 8, 2017
@ixti
Copy link
Contributor Author

ixti commented Feb 15, 2017

Is there still any interest in this PR? @pixeltrix

@ixti
Copy link
Contributor Author

ixti commented Feb 28, 2017

I assume silence and ignore means no interest.

@ixti ixti closed this Feb 28, 2017
@ixti ixti deleted the improve/action-mailer-preview-params branch February 28, 2017 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants