diff --git a/app/helpers/user_notifications_helper.rb b/app/helpers/user_notifications_helper.rb index 77dea02d7a5..05df6b1298e 100644 --- a/app/helpers/user_notifications_helper.rb +++ b/app/helpers/user_notifications_helper.rb @@ -54,6 +54,13 @@ module UserNotificationsHelper raw format_for_email(html) end + def show_name_on_post(post) + SiteSetting.enable_names? && + SiteSetting.display_name_on_posts? && + post.user.name.present? && + post.user.name != post.user.username + end + def format_for_email(html) PrettyText.format_for_email(html).html_safe end diff --git a/app/views/email/_post.html.erb b/app/views/email/_post.html.erb index 122df1af5e5..48da134ce4e 100644 --- a/app/views/email/_post.html.erb +++ b/app/views/email/_post.html.erb @@ -6,7 +6,7 @@ <%= post.user.username %> - <%- if SiteSetting.enable_names? && post.user.name.present? && post.user.name != post.user.username %> + <%- if show_name_on_post(post) %> <%= post.user.name %> <% end %> <%- if post.user.title.present? %>