remove post keeper references

This commit is contained in:
Albert Yi
2019-01-31 15:45:06 -08:00
parent 0c791a1257
commit d8aabff77b
6 changed files with 2 additions and 310 deletions

View File

@@ -59,31 +59,8 @@ class Post < ApplicationRecord
has_many :favorites
has_many :replacements, class_name: "PostReplacement", :dependent => :destroy
serialize :keeper_data, JSON
attr_accessor :old_tag_string, :old_parent_id, :old_source, :old_rating, :has_constraints, :disable_versioning, :view_count
concerning :KeeperMethods do
included do
before_create :initialize_keeper
end
def keeper_id
if PostKeeperManager.enabled?
(keeper_data && keeper_data["uid"]) ? keeper_data["uid"] : uploader_id
else
uploader_id
end
end
def keeper
User.find(keeper_id)
end
def initialize_keeper
self.keeper_data = {uid: uploader_id}
end
end
if PostArchive.enabled?
has_many :versions, -> { Rails.env.test? ? order("post_versions.updated_at ASC, post_versions.id ASC") : order("post_versions.updated_at ASC") }, :class_name => "PostArchive", :dependent => :destroy
end
@@ -620,14 +597,6 @@ class Post < ApplicationRecord
if decrement_tags.any?
Tag.decrement_post_counts(decrement_tags)
end
if PostKeeperManager.enabled? && persisted?
# no need to do this check on the initial create
PostKeeperManager.check_and_assign(self, CurrentUser.id, increment_tags)
# run this again async to check for race conditions
PostKeeperManager.queue_check(id, CurrentUser.id)
end
end
def set_tag_count(category,tagcount)