FIX: Bring email username logic in line with front end

This commit is contained in:
Robin Ward 2015-04-22 16:26:57 -04:00
parent 5c7d6e0a3c
commit 388f51eed7
1 changed files with 5 additions and 1 deletions

View File

@ -54,11 +54,15 @@ module UserNotificationsHelper
raw format_for_email(html) raw format_for_email(html)
end end
def sanitized_name(name)
name.downcase.gsub(/[\s_-]/, '')
end
def show_name_on_post(post) def show_name_on_post(post)
SiteSetting.enable_names? && SiteSetting.enable_names? &&
SiteSetting.display_name_on_posts? && SiteSetting.display_name_on_posts? &&
post.user.name.present? && post.user.name.present? &&
post.user.name != post.user.username sanitized_name(post.user.name) != sanitized_name(post.user.username)
end end
def format_for_email(html) def format_for_email(html)