remove useless content when sending email to a staged used

This commit is contained in:
Régis Hanol 2016-04-11 19:06:10 +02:00
parent bb25200745
commit a359a973e2
3 changed files with 7 additions and 16 deletions

View File

@ -207,10 +207,12 @@ class UserNotifications < ActionMailer::Base
(user.locale.present? && I18n.available_locales.include?(user.locale.to_sym)) ? user.locale : nil (user.locale.present? && I18n.available_locales.include?(user.locale.to_sym)) ? user.locale : nil
end end
def email_post_markdown(post) def email_post_markdown(post, add_posted_by=false)
result = "[email-indent]\n" result = "[email-indent]\n"
result << "#{post.raw}\n\n" result << "#{post.raw}\n\n"
result << "#{I18n.t('user_notifications.posted_by', username: post.username, post_date: post.created_at.strftime("%m/%d/%Y"))}\n\n" if add_posted_by
result << "#{I18n.t('user_notifications.posted_by', username: post.username, post_date: post.created_at.strftime("%m/%d/%Y"))}\n\n"
end
result << "[/email-indent]\n" result << "[/email-indent]\n"
result result
end end
@ -315,7 +317,7 @@ class UserNotifications < ActionMailer::Base
if context_posts.present? if context_posts.present?
context << "-- \n*#{I18n.t('user_notifications.previous_discussion')}*\n" context << "-- \n*#{I18n.t('user_notifications.previous_discussion')}*\n"
context_posts.each do |cp| context_posts.each do |cp|
context << email_post_markdown(cp) context << email_post_markdown(cp, true)
end end
end end
@ -378,7 +380,7 @@ class UserNotifications < ActionMailer::Base
add_re_to_subject: add_re_to_subject, add_re_to_subject: add_re_to_subject,
show_category_in_subject: show_category_in_subject, show_category_in_subject: show_category_in_subject,
private_reply: post.topic.private_message?, private_reply: post.topic.private_message?,
include_respond_instructions: !user.suspended?, include_respond_instructions: !(user.suspended? || user.staged?),
template: template, template: template,
html_override: html, html_override: html,
site_description: SiteSetting.site_description, site_description: SiteSetting.site_description,

View File

@ -2110,7 +2110,6 @@ en:
%{message} %{message}
---
%{respond_instructions} %{respond_instructions}
user_invited_to_private_message_pm_staged: user_invited_to_private_message_pm_staged:
@ -2120,7 +2119,6 @@ en:
%{message} %{message}
---
%{respond_instructions} %{respond_instructions}
user_invited_to_topic: user_invited_to_topic:
@ -2130,7 +2128,6 @@ en:
%{message} %{message}
---
%{respond_instructions} %{respond_instructions}
user_replied: user_replied:
@ -2142,7 +2139,6 @@ en:
%{context} %{context}
---
%{respond_instructions} %{respond_instructions}
user_replied_pm: user_replied_pm:
@ -2154,7 +2150,6 @@ en:
%{context} %{context}
---
%{respond_instructions} %{respond_instructions}
user_quoted: user_quoted:
@ -2166,7 +2161,6 @@ en:
%{context} %{context}
---
%{respond_instructions} %{respond_instructions}
user_linked: user_linked:
@ -2178,7 +2172,6 @@ en:
%{context} %{context}
---
%{respond_instructions} %{respond_instructions}
user_mentioned: user_mentioned:
@ -2190,7 +2183,6 @@ en:
%{context} %{context}
---
%{respond_instructions} %{respond_instructions}
user_group_mentioned: user_group_mentioned:
@ -2202,7 +2194,6 @@ en:
%{context} %{context}
---
%{respond_instructions} %{respond_instructions}
user_posted: user_posted:
@ -2214,7 +2205,6 @@ en:
%{context} %{context}
---
%{respond_instructions} %{respond_instructions}
user_posted_pm: user_posted_pm:
@ -2226,7 +2216,6 @@ en:
%{context} %{context}
---
%{respond_instructions} %{respond_instructions}
user_posted_pm_staged: user_posted_pm_staged:

View File

@ -39,7 +39,7 @@ module Email
string = allow_reply_by_email? ? "user_notifications.reply_by_email" : "user_notifications.visit_link_to_respond" string = allow_reply_by_email? ? "user_notifications.reply_by_email" : "user_notifications.visit_link_to_respond"
string << "_pm" if @opts[:private_reply] string << "_pm" if @opts[:private_reply]
end end
@template_args[:respond_instructions] = I18n.t(string, @template_args) @template_args[:respond_instructions] = "---\n" + I18n.t(string, @template_args)
end end
end end
end end