Skip to content

Commit

Permalink
use fetch_comments function to count blog comments (#6718)
Browse files Browse the repository at this point in the history
  • Loading branch information
nstjean authored and cesswairimu committed Nov 19, 2019
1 parent 71e9628 commit eaf36b1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/views/notes/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
| <%= number_with_delimiter(@node.views) %> <%= t('notes.show.views') %>
<% if @node.comments %>
| <i class="fa fa-comment"></i>
<a href="#comments"> <%= @node.comments.length %> <%= t('notes.show.comments') %> </a>
<a href="#comments"> <%= @node.fetch_comments(current_user).length %> <%= t('notes.show.comments') %> </a>
<% end %>
| <a href="/n/<%= @node.id %>"><i class="fa fa-link"></i></a> <span class="d-none d-xl-inline"><a href="/n/<%= @node.id %>">#<%= @node.id %></a></span>
</span>
<span class="d-none d-lg-inline d-print-none">
| <%= number_with_delimiter(@node.views) %> <%= t('notes.show.views') %>
<% if @node.comments %>
| <i class="fa fa-comment"></i>
<a href="#comments"> <%= @node.comments.length %> <%= t('notes.show.comments') %> </a>
<a href="#comments"> <%= @node.fetch_comments(current_user).length %> <%= t('notes.show.comments') %> </a>
<% end %>
| <a href="/n/<%= @node.id %>"><i class="fa fa-link"></i></a> <span class="d-none d-xl-inline"><a href="/n/<%= @node.id %>">#<%= @node.id %></a></span>
</span>
Expand Down
2 changes: 1 addition & 1 deletion app/views/tag/blog.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<p class="meta" style="color:#888;"><small>
<%=raw translation('tag.blog.by') %> <a href="/profile/<%= node.author.name %>"><%= node.author.name %></a> <%= node.author.new_contributor %>
| <%= distance_of_time_in_words(node.created_at, Time.current, { include_seconds: false, scope: 'datetime.time_ago_in_words' }) %>
| <a href="<%= node.path %>#comments"><i style="color:#888;" class="fa fa-comment-o"></i> <%= node.comments.size %></a>
| <a href="<%= node.path %>#comments"><i style="color:#888;" class="fa fa-comment-o"></i> <%= node.fetch_comments(current_user).length %></a>
<% if params[:controller] == "notes" && params[:action] == "popular" %>
| <%= number_with_delimiter(node.views) %> <%=raw translation('tag.blog.views') %>
<% else %>
Expand Down

0 comments on commit eaf36b1

Please sign in to comment.