mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FIX: remove meta data from lightbox in both excerpt (html & text)
This commit is contained in:
@ -1,13 +1,5 @@
|
||||
module UserNotificationsHelper
|
||||
|
||||
def self.sanitize_options
|
||||
return @sanitize_options if @sanitize_options
|
||||
@sanitize_options = Sanitize::Config::RELAXED.deep_dup
|
||||
@sanitize_options[:elements] << 'aside' << 'div'
|
||||
@sanitize_options[:attributes][:all] << 'class'
|
||||
@sanitize_options
|
||||
end
|
||||
|
||||
def indent(text, by=2)
|
||||
spacer = " " * by
|
||||
result = ""
|
||||
@ -57,21 +49,15 @@ module UserNotificationsHelper
|
||||
end
|
||||
|
||||
def email_excerpt(html, posts_count)
|
||||
# If there's only one post, include the whole thing.
|
||||
if posts_count == 1
|
||||
raw Sanitize.clean(html, UserNotificationsHelper.sanitize_options)
|
||||
else
|
||||
# Otherwise, try just the first paragraph.
|
||||
para = first_paragraph_from(html)
|
||||
raw Sanitize.clean(para.to_s, UserNotificationsHelper.sanitize_options)
|
||||
end
|
||||
# only include 1st paragraph when more than 1 posts
|
||||
html = first_paragraph_from(html).to_s if posts_count > 1
|
||||
raw format_for_email(html)
|
||||
end
|
||||
|
||||
def cooked_post_for_email(post)
|
||||
PrettyText.format_for_email(post.cooked).html_safe
|
||||
def format_for_email(html)
|
||||
PrettyText.format_for_email(html).html_safe
|
||||
end
|
||||
|
||||
|
||||
def email_category(category, opts=nil)
|
||||
opts = opts || {}
|
||||
|
||||
|
Reference in New Issue
Block a user