pools: stop using the pool_string field (#4160).

Stop using the pool_string field internally, but keep maintaining it
until we can drop it later.

* Stop using the pool_string for `pool:<name>` metatag searches.
* Stop using the pool_string in the `Post#pools` method. This is used to
  get the list of pools on post show pages.
This commit is contained in:
evazion
2019-09-06 22:03:40 -05:00
parent 3bd8a5c4e3
commit dc4d2e54b2
6 changed files with 69 additions and 42 deletions

View File

@@ -143,6 +143,16 @@ class PostsControllerTest < ActionDispatch::IntegrationTest
assert_response :success
end
context "with pools" do
should "render the pool list" do
as(@user) { @post.update(tag_string: "newpool:comic") }
get post_path(@post)
assert_response :success
assert_select "#pool-nav .pool-name", /Pool: comic/
end
end
context "with only deleted comments" do
setup do
as(@user) { create(:comment, post: @post, is_deleted: true) }

View File

@@ -1948,17 +1948,28 @@ class PostTest < ActiveSupport::TestCase
should "return posts for the pool:<name> metatag" do
SqsService.any_instance.stubs(:send_message)
FactoryBot.create(:pool, name: "test_a", category: "series")
FactoryBot.create(:pool, name: "test_b", category: "collection")
post1 = FactoryBot.create(:post, tag_string: "pool:test_a")
post2 = FactoryBot.create(:post, tag_string: "pool:test_b")
pool1 = create(:pool, name: "test_a", category: "series")
pool2 = create(:pool, name: "test_b", category: "collection")
post1 = create(:post, tag_string: "pool:test_a")
post2 = create(:post, tag_string: "pool:test_b")
assert_tag_match([post1], "pool:#{pool1.id}")
assert_tag_match([post2], "pool:#{pool2.id}")
assert_tag_match([post1], "pool:TEST_A")
assert_tag_match([post2], "pool:Test_B")
assert_tag_match([post1], "pool:test_a")
assert_tag_match([post2], "-pool:test_a")
assert_tag_match([], "pool:test_a pool:test_b")
assert_tag_match([], "-pool:test_a -pool:test_b")
assert_tag_match([post2, post1], "pool:test*")
assert_tag_match([post2, post1], "pool:any")
assert_tag_match([post2, post1], "-pool:none")
assert_tag_match([], "-pool:any")
assert_tag_match([], "pool:none")
assert_tag_match([post1], "pool:series")