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 end
def show_username_on_post(post) def show_username_on_post(post)
return true if SiteSetting.prioritize_username_in_ux
return true unless SiteSetting.enable_names? return true unless SiteSetting.enable_names?
return true unless SiteSetting.display_name_on_posts? return true unless SiteSetting.display_name_on_posts?
return true unless post.user.name.present? return true unless post.user.name.present?
@ -71,8 +70,6 @@ module UserNotificationsHelper
end end
def show_name_on_post(post) def show_name_on_post(post)
return true unless SiteSetting.prioritize_username_in_ux
SiteSetting.enable_names? && SiteSetting.enable_names? &&
SiteSetting.display_name_on_posts? && SiteSetting.display_name_on_posts? &&
post.user.name.present? && post.user.name.present? &&

View File

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

View File

@ -203,9 +203,11 @@ module Email
style('.previous-discussion', 'font-size: 17px; color: #444; margin-bottom:10px;') 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('.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('.username', "font-size:13px;font-family:'lucida grande',tahoma,verdana,arial,sans-serif;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;font-weight:normal;")
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-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('.post-wrapper', "margin-bottom:25px;")
style('.user-avatar', 'vertical-align:top;width:55px;') style('.user-avatar', 'vertical-align:top;width:55px;')
style('.user-avatar img', nil, width: '45', height: '45') style('.user-avatar img', nil, width: '45', height: '45')