mirror of
https://github.com/neocities/neocities.git
synced 2025-04-24 17:22:35 +02:00
fix deleted comments not being hidden
This commit is contained in:
parent
de669d86cb
commit
bd45dfdab6
2 changed files with 12 additions and 4 deletions
|
@ -16,6 +16,14 @@ class Event < Sequel::Model
|
|||
GLOBAL_VIEWS_MINIMUM = 5
|
||||
GLOBAL_VIEWS_SITE_CHANGE_MINIMUM = 3_000
|
||||
|
||||
def undeleted_comments_count
|
||||
comments_dataset.exclude(is_deleted: true).count
|
||||
end
|
||||
|
||||
def undeleted_comments
|
||||
comments_dataset.exclude(is_deleted: true).order(:created_at).all
|
||||
end
|
||||
|
||||
def self.news_feed_default_dataset
|
||||
if SimpleCache.expired?(:excluded_actioning_site_ids)
|
||||
res = DB[%{select distinct(actioning_site_id) from events join sites on actioning_site_id=sites.id where sites.is_banned='t' or sites.is_nsfw='t' or sites.is_deleted='t'}].all.collect {|r| r[:actioning_site_id]}
|
||||
|
@ -32,7 +40,7 @@ class Event < Sequel::Model
|
|||
exclude(is_banned: true)
|
||||
|
||||
unless excluded_actioning_site_ids.empty?
|
||||
ds.where!("actioning_site_id is null or actioning_site_id not in ?", excluded_actioning_site_ids)
|
||||
return ds.where("actioning_site_id is null or actioning_site_id not in ?", excluded_actioning_site_ids)
|
||||
end
|
||||
|
||||
ds
|
||||
|
|
|
@ -140,10 +140,10 @@
|
|||
<%== erb :'_news_actions', layout: false, locals: {event: event} %>
|
||||
<% end %>
|
||||
|
||||
<% if event.comments_dataset.count > 0 %>
|
||||
<% if event.undeleted_comments_count > 0 %>
|
||||
<div class="content">
|
||||
<div class="comments">
|
||||
<% event.comments.each do |comment| %>
|
||||
<% event.undeleted_comments.each do |comment| %>
|
||||
<% comment_actioning_site = comment.actioning_site_dataset.select(:id, :title, :domain, :username, :stripe_customer_id, :plan_type).first %>
|
||||
<% comment_event_site = comment.event.site_dataset.select(:id, :title, :domain, :username, :stripe_customer_id, :plan_type).first %>
|
||||
<div class="comment" id="comment_<%= comment.id %>">
|
||||
|
|
Loading…
Add table
Reference in a new issue