fixes #2023
This commit is contained in:
@@ -394,6 +394,9 @@ class Tag < ActiveRecord::Base
|
||||
q[:pool] = "none"
|
||||
elsif $2.downcase == "any"
|
||||
q[:pool] = "any"
|
||||
elsif $2.include?("*")
|
||||
pools = Pool.name_matches($2).all(:select => "id", :limit => Danbooru.config.tag_query_limit, :order => "post_count DESC")
|
||||
q[:tags][:include] += pools.map!{|pool| "pool:#{pool.id}"}
|
||||
else
|
||||
q[:tags][:related] << "pool:#{Pool.name_to_id($2)}"
|
||||
end
|
||||
|
||||
@@ -1124,6 +1124,19 @@ class PostTest < ActiveSupport::TestCase
|
||||
assert_equal(post1.id, relation.first.id)
|
||||
end
|
||||
|
||||
should "return posts for the <pool> metatag with a wildcard" do
|
||||
post1 = FactoryGirl.create(:post)
|
||||
post2 = FactoryGirl.create(:post)
|
||||
post3 = FactoryGirl.create(:post)
|
||||
pool1 = FactoryGirl.create(:pool, :name => "test_a")
|
||||
pool2 = FactoryGirl.create(:pool, :name => "test_b")
|
||||
post1.add_pool!(pool1)
|
||||
post3.add_pool!(pool2)
|
||||
relation = Post.tag_match("pool:test*")
|
||||
assert_equal(2, relation.count)
|
||||
assert_equal([post3.id, post1.id], relation.all.map!(&:id))
|
||||
end
|
||||
|
||||
should "return posts for the <user> metatag" do
|
||||
second_user = FactoryGirl.create(:user)
|
||||
post1 = FactoryGirl.create(:post, :uploader => CurrentUser.user)
|
||||
|
||||
Reference in New Issue
Block a user