mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
FIX: sending email wasn't working anymore when a plugin used 'reduce_cooked' (cc @gdpelican)
This commit is contained in:
parent
feffe23cc5
commit
c012b18601
@ -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, style = nil)
|
||||
html = use_excerpt ? post.excerpt : post.cooked
|
||||
PrettyText.format_for_email(html, post, style: style).html_safe
|
||||
PrettyText.format_for_email(html, post, style).html_safe
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -60,7 +60,7 @@
|
||||
<span> - </span>
|
||||
<span><%= I18n.l(post.created_at, format: :long) %></span>
|
||||
</p>
|
||||
<%= raw format_for_email(post, false, style: :notification) %>
|
||||
<%= raw format_for_email(post, false, :notification) %>
|
||||
<hr />
|
||||
</div>
|
||||
<% end %>
|
||||
|
@ -6,6 +6,10 @@ module Email
|
||||
class Styles
|
||||
@@plugin_callbacks = []
|
||||
|
||||
attr_accessor :fragment
|
||||
|
||||
delegate :css, to: :fragment
|
||||
|
||||
def initialize(html, opts=nil)
|
||||
@html = html
|
||||
@opts = opts || {}
|
||||
|
@ -390,11 +390,11 @@ module PrettyText
|
||||
doc.css(".lightbox-wrapper .meta").remove
|
||||
end
|
||||
|
||||
def self.format_for_email(html, post = nil, style: nil)
|
||||
def self.format_for_email(html, post = nil, style = nil)
|
||||
Email::Styles.new(html, style: style).tap do |doc|
|
||||
DiscourseEvent.trigger(:reduce_cooked, doc, post)
|
||||
doc.make_all_links_absolute
|
||||
doc.send :"format_#{style}" if style
|
||||
DiscourseEvent.trigger(:reduce_cooked, doc, post)
|
||||
end.to_html
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user