diff --git a/app/helpers/user_notifications_helper.rb b/app/helpers/user_notifications_helper.rb index afa80d832..4c088836d 100644 --- a/app/helpers/user_notifications_helper.rb +++ b/app/helpers/user_notifications_helper.rb @@ -65,9 +65,9 @@ module UserNotificationsHelper normalize_name(post.user.name) != normalize_name(post.user.username) end - def format_for_email(post, use_excerpt, style = nil) + def format_for_email(post, use_excerpt) html = use_excerpt ? post.excerpt : post.cooked - PrettyText.format_for_email(html, post, style).html_safe + PrettyText.format_for_email(html, post).html_safe end end diff --git a/app/mailers/user_notifications.rb b/app/mailers/user_notifications.rb index be69a384e..dfa195b5d 100644 --- a/app/mailers/user_notifications.rb +++ b/app/mailers/user_notifications.rb @@ -83,11 +83,9 @@ class UserNotifications < ActionMailer::Base return unless @posts_by_topic.present? build_summary_for(user) - build_email @user.email, - from_alias: I18n.t('user_notifications.mailing_list.from', site_name: SiteSetting.title), - subject: I18n.t('user_notifications.mailing_list.subject_template', - site_name: @site_name, - date: @date) + apply_notification_styles build_email @user.email, + from_alias: I18n.t('user_notifications.mailing_list.from', site_name: SiteSetting.title), + subject: I18n.t('user_notifications.mailing_list.subject_template', site_name: @site_name, date: @date) end def digest(user, opts={}) @@ -418,4 +416,12 @@ class UserNotifications < ActionMailer::Base @markdown_linker = MarkdownLinker.new(@base_url) @unsubscribe_key = UnsubscribeKey.create_key_for(@user, "digest") end + + def apply_notification_styles(email) + email.html_part.body = Email::Styles.new(email.html_part.body.to_s).tap do |styles| + styles.format_basic + styles.format_notification + end.to_html + email + end end diff --git a/app/views/email/_post.html.erb b/app/views/email/_post.html.erb index 6a324e301..42bb7afb8 100644 --- a/app/views/email/_post.html.erb +++ b/app/views/email/_post.html.erb @@ -23,7 +23,7 @@
@wiseguy, @trollol what do you guys think?
" output = described_class.format_for_email(html, post) - expect(output).to eq("") + expect(output).to eq("") end it "doesn't change external absolute links" do