Certain parts of comment rendering triggered sql queries that we didn't really need to do. Rework things to avoid this. * Preload comment creators in order to display commenter names with link_to_user. * Preload comment votes in order to display "undo vote" links. Only preload votes for members since anonymous users can't vote and don't have "undo vote" links. * Rework various conditionals to do the filtering in Ruby so that we avoid issuing any extra queries in sql. * Avoid issuing any queries at all when the post doesn't have any comments (when last_commented_at is blank).
8 lines
408 B
Plaintext
8 lines
408 B
Plaintext
<%# record, interval %>
|
|
|
|
<% if record.respond_to?(:updater) && record.updater_id != record.creator_id %>
|
|
<p class="info">Updated by <%= link_to_user record.updater %> <%= time_ago_in_words_tagged(record.updated_at) %></p>
|
|
<% elsif record.updated_at - record.created_at > (local_assigns[:interval] || 5.minutes) %>
|
|
<p class="info">Updated <%= time_ago_in_words_tagged(record.updated_at) %></p>
|
|
<% end %>
|