search: fix noteupdater: vs -noteupdater: mixup.
This commit is contained in:
@@ -256,9 +256,9 @@ class PostQueryBuilder
|
||||
when "-noter"
|
||||
user_subquery_matches(NoteVersion.unscoped.where(version: 1), value, field: :updater).negate
|
||||
when "noteupdater"
|
||||
user_subquery_matches(NoteVersion.unscoped, value, field: :updater).negate
|
||||
when "-noteupdater"
|
||||
user_subquery_matches(NoteVersion.unscoped, value, field: :updater)
|
||||
when "-noteupdater"
|
||||
user_subquery_matches(NoteVersion.unscoped, value, field: :updater).negate
|
||||
when "upvoter", "upvote"
|
||||
user_subquery_matches(PostVote.positive.visible(CurrentUser.user), value, field: :user)
|
||||
when "-upvoter", "-upvote"
|
||||
|
||||
@@ -380,6 +380,18 @@ class PostQueryBuilderTest < ActiveSupport::TestCase
|
||||
assert_tag_match([], "noter:none")
|
||||
end
|
||||
|
||||
should "return posts for the noteupdater:<name> metatag" do
|
||||
user1 = create(:user)
|
||||
user2 = create(:user)
|
||||
note1 = as(user1) { create(:note) }
|
||||
note2 = as(user2) { create(:note) }
|
||||
|
||||
assert_tag_match([note1.post], "noteupdater:#{user1.name}")
|
||||
assert_tag_match([note2.post], "noteupdater:#{user2.name}")
|
||||
assert_tag_match([note2.post], "-noteupdater:#{user1.name}")
|
||||
assert_tag_match([note1.post], "-noteupdater:#{user2.name}")
|
||||
end
|
||||
|
||||
should "return posts for the note_count:<N> metatag" do
|
||||
posts = create_list(:post, 3)
|
||||
create(:note, post: posts[0], is_active: true)
|
||||
|
||||
Reference in New Issue
Block a user