Fix thumbnail appearing next to deleted comments
This commit is contained in:
@@ -32,6 +32,10 @@ class Comment < ActiveRecord::Base
|
||||
where("score >= ?", user.comment_threshold)
|
||||
end
|
||||
|
||||
def undeleted
|
||||
where("is_deleted = false")
|
||||
end
|
||||
|
||||
def post_tags_match(query)
|
||||
PostQueryBuilder.new(query).build(self.joins(:post)).reorder("")
|
||||
end
|
||||
|
||||
@@ -5,15 +5,17 @@
|
||||
<div class="comments-for-post">
|
||||
<div class="list-of-comments">
|
||||
<% @comments.each do |comment| %>
|
||||
<div id="post_<%= comment.post.id %>" class="post <%= PostPresenter.preview_class(comment.post) %>" <%= PostPresenter.data_attributes(comment.post) %>>
|
||||
<div class="preview">
|
||||
<% if comment.post.visible? %>
|
||||
<%= link_to(image_tag(comment.post.preview_file_url), post_path(comment.post)) %>
|
||||
<% end %>
|
||||
<% if CurrentUser.is_moderator? || !comment.is_deleted? %>
|
||||
<div id="post_<%= comment.post.id %>" class="post <%= PostPresenter.preview_class(comment.post) %>" <%= PostPresenter.data_attributes(comment.post) %>>
|
||||
<div class="preview">
|
||||
<% if comment.post.visible? %>
|
||||
<%= link_to(image_tag(comment.post.preview_file_url), post_path(comment.post)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render :partial => "comments/partials/show/comment", :collection => [comment] %>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<%= render :partial => "comments/partials/show/comment", :collection => [comment] %>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,15 +12,17 @@
|
||||
<% end %>
|
||||
|
||||
<% @posts.select {|x| x.visible?}.each do |post| %>
|
||||
<div id="post_<%= post.id %>" class="post <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
|
||||
<div class="preview">
|
||||
<% if post.visible? %>
|
||||
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
|
||||
<% end %>
|
||||
<% if CurrentUser.is_moderator? || post.comments.undeleted.exists? %>
|
||||
<div id="post_<%= post.id %>" class="post <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
|
||||
<div class="preview">
|
||||
<% if post.visible? %>
|
||||
<%= link_to(image_tag(post.preview_file_url), post_path(post)) %>
|
||||
<% end %>
|
||||
</div>
|
||||
<%= render "comments/partials/index/list", :post => post, :comments => post.comments.visible(CurrentUser.user).recent.reverse, :show_header => true %>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<%= render "comments/partials/index/list", :post => post, :comments => post.comments.visible(CurrentUser.user).recent.reverse, :show_header => true %>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<%= numbered_paginator(@posts) %>
|
||||
|
||||
Reference in New Issue
Block a user