FIX: Don't display names on emails if display_name_on_posts is false

Note that `enable_names` was always respected.
This commit is contained in:
Robin Ward 2015-04-22 16:15:23 -04:00
parent 839416212e
commit 5c7d6e0a3c
2 changed files with 8 additions and 1 deletions

View file

@ -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

View file

@ -6,7 +6,7 @@
</td>
<td>
<a class="username" href="<%=Discourse.base_url%>/users/<%= post.user.username_lower%>" target="_blank"><%= post.user.username %></a>
<%- if SiteSetting.enable_names? && post.user.name.present? && post.user.name != post.user.username %>
<%- if show_name_on_post(post) %>
<a class="user-name" href="<%=Discourse.base_url%>/users/<%= post.user.username_lower%>" target="_blank"><%= post.user.name %></a>
<% end %>
<%- if post.user.title.present? %>