<% cache("user-profile-comments-#{@user.last_comment_at}-#{@user.id}-#{@comments.size}", expires_in: 2.days) do %>
<% if @comments.present? %> <% if params[:view] == "comments" %>

<% if high_number_of_comments?(@user.comments_count) %> Last <%= number_of_comments_to_render %> comments <% else %> All <%= @user.comments_count %> comments <% end %>

<% else %>

Recent comments

<% end %> <% end %> <% @comments.each do |comment| %> <% if comment.commentable.present? && comment.commentable.published && !comment.deleted %>

<%= comment.commentable.title %>

<%= truncate(strip_tags(comment.processed_html), length: 64).html_safe %>

<% end %> <% end %> <% if params[:view] != "comments" && high_number_of_comments?(@user.comments_count) %>
View last <%= pluralize(number_of_comments_to_render, "Comment") %>
<% elsif params[:view] != "comments" && view_all_comments?(@user.comments_count) %>
View all <%= @user.comments_count %> comments
<% end %>
<% end %>