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)
|
where("score >= ?", user.comment_threshold)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def undeleted
|
||||||
|
where("is_deleted = false")
|
||||||
|
end
|
||||||
|
|
||||||
def post_tags_match(query)
|
def post_tags_match(query)
|
||||||
PostQueryBuilder.new(query).build(self.joins(:post)).reorder("")
|
PostQueryBuilder.new(query).build(self.joins(:post)).reorder("")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<div class="comments-for-post">
|
<div class="comments-for-post">
|
||||||
<div class="list-of-comments">
|
<div class="list-of-comments">
|
||||||
<% @comments.each do |comment| %>
|
<% @comments.each do |comment| %>
|
||||||
|
<% 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 id="post_<%= comment.post.id %>" class="post <%= PostPresenter.preview_class(comment.post) %>" <%= PostPresenter.data_attributes(comment.post) %>>
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<% if comment.post.visible? %>
|
<% if comment.post.visible? %>
|
||||||
@@ -15,6 +16,7 @@
|
|||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% @posts.select {|x| x.visible?}.each do |post| %>
|
<% @posts.select {|x| x.visible?}.each do |post| %>
|
||||||
|
<% if CurrentUser.is_moderator? || post.comments.undeleted.exists? %>
|
||||||
<div id="post_<%= post.id %>" class="post <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
|
<div id="post_<%= post.id %>" class="post <%= PostPresenter.preview_class(post) %>" <%= PostPresenter.data_attributes(post) %>>
|
||||||
<div class="preview">
|
<div class="preview">
|
||||||
<% if post.visible? %>
|
<% if post.visible? %>
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
<div class="clearfix"></div>
|
<div class="clearfix"></div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= numbered_paginator(@posts) %>
|
<%= numbered_paginator(@posts) %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user