Files
danbooru/app/views/comments/_index_by_post.html.erb
evazion be36968b6d Fix #3351: Mod+: Treat deleted comments as below score threshold.
Comments have three states: visible, hidden, and invisible. Visible
comments are always shown. Hidden comments are not shown until the user
clicks 'Show all comments'. Invisible comments are never shown to the
user. Deleted comments are treated as hidden for moderators and
invisible for normal users. Thresholded comments are treated as hidden
for all users.
2019-08-31 16:24:44 -05:00

28 lines
1.2 KiB
Plaintext

<div id="p-index-by-post">
<% if !CurrentUser.user.is_builder? %>
<div style="margin-bottom: 1em;">
<h2>Before commenting, read the <%= link_to "how to comment guide", wiki_pages_path(:search => {:title => "howto:comment"}) %>.</h2>
</div>
<% end %>
<% if @posts.blank? %>
<%= render "post_sets/blank" %>
<% end %>
<% @posts.select(&:visible?).each do |post| %>
<% if post.comments.visible(CurrentUser.user).any? || post.comments.hidden(CurrentUser.user).any? %>
<%= content_tag(:div, { id: "post_#{post.id}", class: ["post", *PostPresenter.preview_class(post)].join(" ") }.merge(PostPresenter.data_attributes(post))) do %>
<div class="preview">
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
</div>
<%= render "comments/partials/index/list", post: post, comments: post.comments.visible(CurrentUser.user).last(6), page: :comments %>
<div class="clearfix"></div>
<% end %>
<% end %>
<% end %>
</div>
<%= numbered_paginator(@posts) %>
<% content_for(:html_header, auto_discovery_link_tag(:atom, comments_url(:atom, search: { do_not_bump_post: true }), title: "Comments")) %>