search: add comment_count, note_count metatags (#4004).
Add these metatags: * comment_count * deleted_comment_count * active_comment_count * note_count * deleted_note_count * active_note_count * order:comment_count * order:deleted_comment_count * order:active_comment_count * order:note_count * order:deleted_note_count * order:active_note_count
This commit is contained in:
@@ -2103,6 +2103,16 @@ class PostTest < ActiveSupport::TestCase
|
||||
assert_tag_match([posts[1]], "noter:none")
|
||||
end
|
||||
|
||||
should "return posts for the note_count:<N> metatag" do
|
||||
posts = FactoryBot.create_list(:post, 3)
|
||||
FactoryBot.create(:note, post: posts[0], is_active: true)
|
||||
FactoryBot.create(:note, post: posts[1], is_active: false)
|
||||
|
||||
assert_tag_match([posts[1], posts[0]], "note_count:1")
|
||||
assert_tag_match([posts[0]], "active_note_count:1")
|
||||
assert_tag_match([posts[1]], "deleted_note_count:1")
|
||||
end
|
||||
|
||||
should "return posts for the artcomm:<name> metatag" do
|
||||
users = FactoryBot.create_list(:user, 2)
|
||||
posts = FactoryBot.create_list(:post, 2)
|
||||
@@ -2387,6 +2397,8 @@ class PostTest < ActiveSupport::TestCase
|
||||
p
|
||||
end
|
||||
|
||||
FactoryBot.create(:note, post: posts.second)
|
||||
|
||||
assert_tag_match(posts.reverse, "order:id_desc")
|
||||
assert_tag_match(posts.reverse, "order:score")
|
||||
assert_tag_match(posts.reverse, "order:favcount")
|
||||
@@ -2404,6 +2416,8 @@ class PostTest < ActiveSupport::TestCase
|
||||
assert_tag_match(posts.reverse, "order:chartags")
|
||||
assert_tag_match(posts.reverse, "order:copytags")
|
||||
assert_tag_match(posts.reverse, "order:rank")
|
||||
assert_tag_match(posts.reverse, "order:note_count")
|
||||
assert_tag_match(posts.reverse, "order:note_count_desc")
|
||||
|
||||
assert_tag_match(posts, "order:id_asc")
|
||||
assert_tag_match(posts, "order:score_asc")
|
||||
@@ -2421,6 +2435,7 @@ class PostTest < ActiveSupport::TestCase
|
||||
assert_tag_match(posts, "order:arttags_asc")
|
||||
assert_tag_match(posts, "order:chartags_asc")
|
||||
assert_tag_match(posts, "order:copytags_asc")
|
||||
assert_tag_match(posts, "order:note_count_asc")
|
||||
end
|
||||
|
||||
should "return posts for order:comment_bumped" do
|
||||
|
||||
Reference in New Issue
Block a user