Skip to content

A platform for community discussion. Free, open, simple.

PERF: Avoid calling the same translation twice when rendering lists view (#22976)

Alan Guo Xiang Tan5d1a9a44c613
diff --git a/app/views/list/list.erb b/app/views/list/list.erb
index e322560d233..f673ed2bbc7 100644
--- a/app/views/list/list.erb
+++ b/app/views/list/list.erb
@@ -88,7 +88,8 @@
<td class='posters'>
<% t.posters.each do |poster| %>
<a href="<%= Discourse.base_url %>/u/<%= poster.user.username %>" class="<%= poster.extras %>">
- <img width="25" height="25" src="<%= poster.user.avatar_template.gsub('{size}', '25') %>" class="avatar" title='<%= h(poster.name_and_description) %>' aria-label='<%= h(poster.name_and_description) %>'>
+ <%- poster_name_and_description = h(poster.name_and_description) %>
+ <img width="25" height="25" src="<%= poster.user.avatar_template.gsub('{size}', '25') %>" class="avatar" title='<%= poster_name_and_description %>' aria-label='<%= poster_name_and_description %>'>
</a>
<% end %>
</td>