diff --git a/app/logical/post_query_builder.rb b/app/logical/post_query_builder.rb index bde7573fb..456e6d5b4 100644 --- a/app/logical/post_query_builder.rb +++ b/app/logical/post_query_builder.rb @@ -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" diff --git a/test/unit/post_query_builder_test.rb b/test/unit/post_query_builder_test.rb index 6d181b657..226cedd71 100644 --- a/test/unit/post_query_builder_test.rb +++ b/test/unit/post_query_builder_test.rb @@ -380,6 +380,18 @@ class PostQueryBuilderTest < ActiveSupport::TestCase assert_tag_match([], "noter:none") end + should "return posts for the noteupdater: 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: metatag" do posts = create_list(:post, 3) create(:note, post: posts[0], is_active: true)