fixes #2447: Display disapproval counts in status bar to uploader and approvers
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
class PostDisapproval < ActiveRecord::Base
|
||||
DELETION_THRESHOLD = 1.month
|
||||
|
||||
belongs_to :post
|
||||
belongs_to :user
|
||||
validates_uniqueness_of :post_id, :scope => [:user_id], :message => "have already hidden this post"
|
||||
@@ -10,7 +12,7 @@ class PostDisapproval < ActiveRecord::Base
|
||||
scope :disinterest, lambda {where(:reason => ["disinterest", "legacy"])}
|
||||
|
||||
def self.prune!
|
||||
joins(:post).where("posts.is_pending = FALSE AND posts.is_flagged = FALSE").each do |post_disapproval|
|
||||
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
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user