PERF: Don't allocate extra array.

This commit is contained in:
Guo Xiang Tan 2017-05-02 11:54:23 +08:00
parent 3460b506d8
commit f5b11cb429

View File

@ -20,21 +20,21 @@
<td>
<h4 style="padding: 0 25px; margin: 10px 0;"><%= t('user_notifications.mailing_list.new_topics') %></h3>
<ul>
<% @new_topic_posts.keys.each do |topic| %>
<%= mailing_list_topic(topic, @new_topic_posts[topic].length) %>
<% @new_topic_posts.each do |topic, posts| %>
<%= mailing_list_topic(topic, posts.length) %>
<% end %>
</ul>
<h4 style="padding: 0 25px; margin: 10px 0;"><%= t('user_notifications.mailing_list.topic_updates') %></h3>
<ul>
<% @existing_topic_posts.keys.each do |topic| %>
<%= mailing_list_topic(topic, @existing_topic_posts[topic].length) %>
<% @existing_topic_posts.each do |topic, posts| %>
<%= mailing_list_topic(topic, posts.length) %>
<% end %>
</ul>
</td>
</tr>
</table>
<table style='width: 100%; background: #eee;' cellspacing='0' cellpadding='0'>
<% @posts_by_topic.keys.each do |topic| %>
<% @posts_by_topic.each do |topic, posts| %>
<tr>
<td>
<h3 style='padding: 20px 20px 10px; margin: 0;'>
@ -45,7 +45,7 @@
<%- unless SiteSetting.private_email? %>
<tr>
<td style='border-left: 20px solid #eee; border-right: 20px solid #eee; border-bottom: 10px solid #eee; padding: 10px 10px; background: #fff;'>
<% @posts_by_topic[topic].each do |post| %>
<% posts.each do |post| %>
<div>
<img style="float: left; width: 20px; padding-right: 5px;" src="<%= post.user.small_avatar_url %>" title="<%= post.user.username%>">
<p style="font-size: 15px; color: #888">