FIX: Provide the ability to reduce cooked content

This allows us to strip polls from the group posts page.
This commit is contained in:
Robin Ward
2016-04-13 13:24:39 -04:00
parent 8fcd359e2a
commit e91379916b
5 changed files with 25 additions and 19 deletions

View File

@ -51,7 +51,7 @@ module UserNotificationsHelper
def email_excerpt(html, posts_count)
# 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)
PrettyText.format_for_email(html).html_safe
end
def normalize_name(name)
@ -65,8 +65,9 @@ module UserNotificationsHelper
normalize_name(post.user.name) != normalize_name(post.user.username)
end
def format_for_email(html)
PrettyText.format_for_email(html).html_safe
def format_for_email(post, use_excerpt)
html = use_excerpt ? post.excerpt : post.cooked
PrettyText.format_for_email(html, post).html_safe
end
end