From 80d881bfcba6a03fb48853351f872be37ca34c70 Mon Sep 17 00:00:00 2001 From: evazion Date: Sat, 31 Aug 2019 20:09:41 -0500 Subject: [PATCH] Fix #4148: Don't prune votes. --- app/logical/danbooru_maintenance.rb | 2 -- app/models/comment_vote.rb | 4 ---- app/models/post_vote.rb | 4 ---- 3 files changed, 10 deletions(-) diff --git a/app/logical/danbooru_maintenance.rb b/app/logical/danbooru_maintenance.rb index 8811dd6e1..e0a5da99d 100644 --- a/app/logical/danbooru_maintenance.rb +++ b/app/logical/danbooru_maintenance.rb @@ -11,8 +11,6 @@ module DanbooruMaintenance PostPruner.new.prune! Upload.where('created_at < ?', 1.day.ago).delete_all Delayed::Job.where('created_at < ?', 45.days.ago).delete_all - PostVote.prune! - CommentVote.prune! PostDisapproval.prune! ForumSubscription.process_all! TagAlias.update_cached_post_counts_for_all diff --git a/app/models/comment_vote.rb b/app/models/comment_vote.rb index bda9a2db2..f4959583f 100644 --- a/app/models/comment_vote.rb +++ b/app/models/comment_vote.rb @@ -10,10 +10,6 @@ class CommentVote < ApplicationRecord validate :validate_comment_can_be_down_voted validates_inclusion_of :score, :in => [-1, 1], :message => "must be 1 or -1" - def self.prune! - where("created_at < ?", 14.days.ago).delete_all - end - def self.search(params) q = where("true") return q if params.blank? diff --git a/app/models/post_vote.rb b/app/models/post_vote.rb index f6c7ce361..ffb063940 100644 --- a/app/models/post_vote.rb +++ b/app/models/post_vote.rb @@ -11,10 +11,6 @@ class PostVote < ApplicationRecord after_create :update_post_on_create after_destroy :update_post_on_destroy - def self.prune! - where("created_at < ?", 90.days.ago).delete_all - end - def self.positive_user_ids select_values_sql("select user_id from post_votes where score > 0 group by user_id having count(*) > 100") end