simplified post disapproval pruning

This commit is contained in:
r888888888
2015-07-23 14:35:28 -07:00
parent 43377e3a82
commit 39247711cb

View File

@@ -12,9 +12,7 @@ class PostDisapproval < ActiveRecord::Base
scope :disinterest, lambda {where(:reason => ["disinterest", "legacy"])}
def self.prune!
PostDisapproval.joins(:post).where("posts.is_pending = FALSE AND posts.is_flagged = FALSE and post_disapprovals.created_at < ?", DELETION_THRESHOLD.ago).each do |post_disapproval|
post_disapproval.destroy
end
PostDisapproval.destroy_all(["created_at < ?", DELETION_THRESHOLD.ago])
end
def create_downvote