posts: stop using pool_string attribute.

Stop using the pool_string attribute on posts:

* Stop updating it when adding or removing posts from pools.
* Stop returning pool_string in the /posts.json API.
* Stop including the `data-pools` attribute on thumbnails.

The pool_string attribute was used in the past to facilitate pool:X
searches. Posts had a hidden pool_string attribute that contained a list
of every pool the post belonged to. These pools were treated like fake
hidden tags on the post and a search for `pool:X` was treated like a tag
search.

The pool_string has no longer been used for this purpose for a long time
now, and was only maintained for API compatibility purposes. Getting rid
of it eliminates a bunch of legacy cruft relating to adding and removing
posts from pools.

If you need to see which pools a post belongs to, do this:

* https://danbooru.donmai.us/pools.json?search[post_ids_include_any]=318550

The `data-pools` attribute on thumbnails was used by some people to add
custom borders to pooled posts with custom CSS. This will no longer
work. This was already broken because it included things like collection
pools and deleted pools, which you probably didn't want. Use a
userscript to add this attribute back to thumbnails if you need it.
This commit is contained in:
evazion
2021-10-07 05:55:43 -05:00
parent 595e02ab45
commit 7d503f088e
7 changed files with 13 additions and 161 deletions

View File

@@ -751,7 +751,6 @@ class PostTest < ActiveSupport::TestCase
@post.reload
@pool.reload
assert_equal([@post.id], @pool.post_ids)
assert_equal("pool:#{@pool.id}", @post.pool_string)
end
end
@@ -759,7 +758,7 @@ class PostTest < ActiveSupport::TestCase
setup do
@pool = FactoryBot.create(:pool)
@post = FactoryBot.create(:post, :tag_string => "aaa")
@post.add_pool!(@pool)
@pool.add!(@post)
@post.tag_string = "aaa -pool:#{@pool.id}"
@post.save
end
@@ -768,7 +767,6 @@ class PostTest < ActiveSupport::TestCase
@post.reload
@pool.reload
assert_equal([], @pool.post_ids)
assert_equal("", @post.pool_string)
end
end
@@ -782,7 +780,6 @@ class PostTest < ActiveSupport::TestCase
@post.reload
@pool.reload
assert_equal([@post.id], @pool.post_ids)
assert_equal("pool:#{@pool.id}", @post.pool_string)
end
end
@@ -797,7 +794,6 @@ class PostTest < ActiveSupport::TestCase
@post.reload
@pool.reload
assert_equal([@post.id], @pool.post_ids)
assert_equal("pool:#{@pool.id}", @post.pool_string)
end
end
@@ -808,7 +804,6 @@ class PostTest < ActiveSupport::TestCase
@post.reload
assert_not_nil(@pool)
assert_equal([@post.id], @pool.post_ids)
assert_equal("pool:#{@pool.id}", @post.pool_string)
end
end
@@ -1661,36 +1656,6 @@ class PostTest < ActiveSupport::TestCase
setup do
SqsService.any_instance.stubs(:send_message)
end
context "Removing a post from a pool" do
should "update the post's pool string" do
post = FactoryBot.create(:post)
pool = FactoryBot.create(:pool)
post.add_pool!(pool)
post.remove_pool!(pool)
post.reload
assert_equal("", post.pool_string)
post.remove_pool!(pool)
post.reload
assert_equal("", post.pool_string)
end
end
context "Adding a post to a pool" do
should "update the post's pool string" do
post = FactoryBot.create(:post)
pool = FactoryBot.create(:pool)
post.add_pool!(pool)
post.reload
assert_equal("pool:#{pool.id}", post.pool_string)
post.add_pool!(pool)
post.reload
assert_equal("pool:#{pool.id}", post.pool_string)
post.remove_pool!(pool)
post.reload
assert_equal("", post.pool_string)
end
end
end
context "Uploading:" do