From f36719c1f5aac7e72e12f298cf9e23a2076ac17b Mon Sep 17 00:00:00 2001 From: Arpit Jalan Date: Thu, 20 Feb 2020 17:45:14 +0530 Subject: [PATCH] FIX: respect prioritize_username_in_ux setting in email UX: only the first attribute should be hyperlinked UX: add margin based on attribute position --- app/helpers/user_notifications_helper.rb | 3 --- app/views/email/_post.html.erb | 17 +++++++++++------ lib/email/styles.rb | 8 +++++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/helpers/user_notifications_helper.rb b/app/helpers/user_notifications_helper.rb index 22385175f82..4389125bd1a 100644 --- a/app/helpers/user_notifications_helper.rb +++ b/app/helpers/user_notifications_helper.rb @@ -62,7 +62,6 @@ module UserNotificationsHelper end def show_username_on_post(post) - return true if SiteSetting.prioritize_username_in_ux return true unless SiteSetting.enable_names? return true unless SiteSetting.display_name_on_posts? return true unless post.user.name.present? @@ -71,8 +70,6 @@ module UserNotificationsHelper end def show_name_on_post(post) - return true unless SiteSetting.prioritize_username_in_ux - SiteSetting.enable_names? && SiteSetting.display_name_on_posts? && post.user.name.present? && diff --git a/app/views/email/_post.html.erb b/app/views/email/_post.html.erb index 3a56269ae26..0a744cfb9a0 100644 --- a/app/views/email/_post.html.erb +++ b/app/views/email/_post.html.erb @@ -5,12 +5,17 @@ - <%- if show_username_on_post(post) %> - <%= post.user.username %> - <% end %> - <%- if show_name_on_post(post) %> - <%= post.user.name %> - <% end %> + <%- if SiteSetting.prioritize_username_in_ux %> + <%= post.user.username %> + <%- if show_name_on_post(post) %> + <%= post.user.name %> + <% end %> + <%- else %> + <%= post.user.name %> + <%- if show_username_on_post(post) %> + <%= post.user.username %> + <% end %> + <%- end %> <%- if post.user.title.present? %> <%= post.user.title %> <% end %> diff --git a/lib/email/styles.rb b/lib/email/styles.rb index 852ef80e705..95eec6be126 100644 --- a/lib/email/styles.rb +++ b/lib/email/styles.rb @@ -203,9 +203,11 @@ module Email style('.previous-discussion', 'font-size: 17px; color: #444; margin-bottom:10px;') style('.notification-date', "text-align:right;color:#999999;padding-right:5px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;font-size:11px") - style('.username', "font-size:13px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;color:#{SiteSetting.email_link_color};text-decoration:none;font-weight:bold") - style('.user-title', "font-size:13px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;text-decoration:none;margin-left:7px;color: #999;") - style('.user-name', "font-size:13px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;text-decoration:none;margin-left:7px;color: #{SiteSetting.email_link_color};font-weight:normal;") + style('.username', "font-size:13px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;text-decoration:none;font-weight:bold") + style('.user-name', "font-size:13px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;text-decoration:none;font-weight:normal;") + style('.username-link', "color:#{SiteSetting.email_link_color};") + style('.username-title', "color:#777;margin-left:5px;") + style('.user-title', "font-size:13px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;text-decoration:none;margin-left:5px;color: #999;") style('.post-wrapper', "margin-bottom:25px;") style('.user-avatar', 'vertical-align:top;width:55px;') style('.user-avatar img', nil, width: '45', height: '45')