pools: stop maintaining pool category pseudotags in pool strings (#4160)

Stop maintaining pool category pseudo tags (pool:series, pool:collection)
in pool strings. They're no longer used and the changes to the
`Post#pools` method in dc4d2e54b caused issues with this.

Also allow Members to change the category of large pools again. This was
only restricted because maintaining these pseudotags forced us to update
every post in the pool whenever a pool's category was changed.
This commit is contained in:
evazion
2019-09-08 23:28:02 -05:00
parent d0f060d8eb
commit 763ac1a7e0
7 changed files with 13 additions and 98 deletions

View File

@@ -30,7 +30,6 @@ class Post < ApplicationRecord
validate :updater_can_change_rating
before_save :update_tag_post_counts
before_save :set_tag_counts
after_save :set_pool_category_pseudo_tags
before_create :autoban
after_save :create_version
after_save :update_parent_on_save
@@ -1041,7 +1040,6 @@ class Post < ApplicationRecord
with_lock do
self.pool_string = "#{pool_string} pool:#{pool.id}".strip
set_pool_category_pseudo_tags
update_column(:pool_string, pool_string) unless new_record?
pool.add!(self)
end
@@ -1053,7 +1051,6 @@ class Post < ApplicationRecord
with_lock do
self.pool_string = pool_string.gsub(/(?:\A| )pool:#{pool.id}(?:\Z| )/, " ").strip
set_pool_category_pseudo_tags
update_column(:pool_string, pool_string) unless new_record?
pool.remove!(self)
end
@@ -1064,18 +1061,6 @@ class Post < ApplicationRecord
pool.remove!(self)
end
end
def set_pool_category_pseudo_tags
self.pool_string = (pool_string.split - ["pool:series", "pool:collection"]).join(" ")
pool_categories = pools.undeleted.pluck(:category)
if pool_categories.include?("series")
self.pool_string = "#{pool_string} pool:series".strip
end
if pool_categories.include?("collection")
self.pool_string = "#{pool_string} pool:collection".strip
end
end
end
module VoteMethods