From 388f51eed7006bc2057e77fcda87a4b22f1ea12c Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Wed, 22 Apr 2015 16:26:57 -0400 Subject: [PATCH] FIX: Bring email username logic in line with front end --- app/helpers/user_notifications_helper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/helpers/user_notifications_helper.rb b/app/helpers/user_notifications_helper.rb index 05df6b1298e..320b7f7ce85 100644 --- a/app/helpers/user_notifications_helper.rb +++ b/app/helpers/user_notifications_helper.rb @@ -54,11 +54,15 @@ module UserNotificationsHelper raw format_for_email(html) end + def sanitized_name(name) + name.downcase.gsub(/[\s_-]/, '') + 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 + sanitized_name(post.user.name) != sanitized_name(post.user.username) end def format_for_email(html)