-
-
Notifications
You must be signed in to change notification settings - Fork 395
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 newsletter html containing style tag content #6876
Fix newsletter html containing style tag content #6876
Conversation
Not particularly related to fixing this issue but just to mention also that this does not have any effect right now for the email: decidim/decidim-core/app/cells/decidim/newsletter_templates/image_text_cta/show.erb Lines 2 to 6 in 98a2709
It only has an effect when viewing the newsletter in browser. In the email it would have exactly the same effect if it wasn't there because the elements will get inline styles based on the style tags in the It was introduced by #5887. |
Really interesting fix here @ivan-mr @tramuntanal . This was what we were talking about in last daily meeting about that weird html code in emails.. We'll take note to make corresponding backports if so ! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @ahukkanen ! thanks.
…ngs_content_block * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
…_content_block * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
…cipatory_processes_content_block * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
…link * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
…ighted_groups * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
…s_and_processes_block * develop: (22 commits) Fix email CTA alignment on Outlook and Windows Mail (#6895) Fix mailer meeting registration invitation using path instead of URL (#6965) Fix the data portability exporter when zip is not in the gemfile (#6969) Convert technical docs to Antora (#6526) New Crowdin updates (#6957) Bugfix - moderated meetings are displayed in the meetings index page (#6927) Add HTML Content Blocks in Process Groups (#6823) Prevent error in view due to optional html not showing (#6942) Improve layout for standalone T&C page (#6944) chore: move rubocop ruby config to own file (#6952) Fix some strings (#6958) Fix newsletter html containing style tag content (#6876) New Crowdin updates (#6945) New Crowdin updates (#6926) Localize a string in conference speaker (#6866) Fix broken dashboard action logs under certain conditions (#6857) Fix traceability logs with invalid record (#6879) Allow user to drag address on proposal map (#6291) New Crowdin updates (#6898) Update release notes documentation (#6809) ...
🎩 What? Why?
Decidim is using Premailer to convert the HTML to plain text. A part of the message is displayed in the beginning of the HTML emails as well.
In #5887 newsletter templates were added which apparently contain inline
<style>
tags within the HTML content of the message:decidim/decidim-core/app/cells/decidim/newsletter_templates/image_text_cta/show.erb
Lines 2 to 6 in 98a2709
The problem is that premailer does not strip out the style tags by default and it leaves the content inside the
<style>
tag to the final plain text email:https://github.com/premailer/premailer/blob/ae21ddab9302cf3e3b9dad9c3cd1115487f06acb/lib/premailer/html_to_plain_text.rb#L16-L129
This causes the beginning of the emails to contain the contents of the inline
<style>
tags within the emails (see the screenshot).This PR fixes the issue by customizing the Premailer adapter for stripping out the
<style>
tags before passing the HTML content to the Premailer's method.📌 Related Issues
Testing
📋 Checklist
docs/
.📷 Screenshots
An image how this shows up in the email:
![Style tag contents at the beginning of the emails](https://user-images.githubusercontent.com/864340/99383808-16c4ad80-28d7-11eb-8ec4-cb1af1c2130c.png)