FIX: respect prioritize_username_in_ux setting in email

UX: only the first attribute should be hyperlinked
UX: add margin based on attribute position
This commit is contained in:
Arpit Jalan 2020-02-20 17:45:14 +05:30
parent b0f4149d6e
commit f36719c1f5
3 changed files with 16 additions and 12 deletions

View File

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

View File

@ -5,12 +5,17 @@
<img src="<%= post.user.small_avatar_url %>" title="<%= post.user.username%>">
</td>
<td>
<%- if show_username_on_post(post) %>
<a class="username" href="<%=Discourse.base_url%>/u/<%= post.user.username_lower%>" target="_blank"><%= post.user.username %></a>
<% end %>
<%- if show_name_on_post(post) %>
<a class="user-name" href="<%=Discourse.base_url%>/u/<%= post.user.username_lower%>" target="_blank"><%= post.user.name %></a>
<% end %>
<%- if SiteSetting.prioritize_username_in_ux %>
<a class="username username-link" href="<%=Discourse.base_url%>/u/<%= post.user.username_lower%>" target="_blank"><%= post.user.username %></a>
<%- if show_name_on_post(post) %>
<span class='user-name username-title'><%= post.user.name %></span>
<% end %>
<%- else %>
<a class="user-name username-link" href="<%=Discourse.base_url%>/u/<%= post.user.username_lower%>" target="_blank"><%= post.user.name %></a>
<%- if show_username_on_post(post) %>
<span class='username username-title'><%= post.user.username %></span>
<% end %>
<%- end %>
<%- if post.user.title.present? %>
<span class='user-title'><%= post.user.title %></span>
<% end %>

View File

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