kshnurov / mandrill_dm

A basic Mandrill delivery method for Rails.
MIT License
46 stars 45 forks source link

Fix the problem when we have just an html part but showed up as text #45

Closed norbertszivos closed 8 years ago

norbertszivos commented 8 years ago

This PR is a patch for #44 issue

The problem was that on Rails if we have mailer with just an html content, than we got this message as a plain text and not html. The mail.text? at this case was true what is not definitely not true. It looks like under Rails mail.text? is always true if not multipart.

kshnurov commented 8 years ago

mail.text? checks for text, which is true for both text/plain and text/html. If there's only one part, there will be no html_part or text_part, that's why this was failing. @Sysqa could you, please, add a few tests for this case?

norbertszivos commented 8 years ago

My problem is that here the text? working as I expected, but under Rails text? is always true except if the email is multipart. That's why we got the wrong email part. So it's hard to test something what is not happening here.

Eiiki commented 8 years ago

@spovich it would be very much appreciated if you could take a look at this and give your feedback. This is a pretty crucial bug to this gem.

norbertszivos commented 8 years ago

@kshnurov thanks the mime_type suggestion. I missed somehow. Could you check the modifications with @spovich ?

kshnurov commented 8 years ago

@Sysqa mail.mime_type == 'text/html' ? true : false is equal to mail.mime_type == 'text/html'.

norbertszivos commented 8 years ago

true, I couldn't thinking at midnight

einarj commented 8 years ago

Just tried this branch on my project and it works like a charm, thanks @Sysqa 👍

You probably want to fix the broken spec though so it this can be merged.

kshnurov commented 8 years ago

@spovich it's time for a new version

spovich commented 8 years ago

@kshnurov done!