diff --git a/app/logical/bulk_update_request_processor.rb b/app/logical/bulk_update_request_processor.rb index 1906240d2..794b917be 100644 --- a/app/logical/bulk_update_request_processor.rb +++ b/app/logical/bulk_update_request_processor.rb @@ -264,14 +264,11 @@ class BulkUpdateRequestProcessor end def self.mass_update(antecedent, consequent, user: User.system) - normalized_antecedent = PostQueryBuilder.new(antecedent).split_query - normalized_consequent = PostQueryBuilder.new(consequent).parse_tag_edit - CurrentUser.scoped(user) do - Post.anon_tag_match(normalized_antecedent.join(" ")).reorder(nil).parallel_each do |post| + Post.anon_tag_match(antecedent).reorder(nil).parallel_each do |post| post.with_lock do - tags = (post.tag_array - normalized_antecedent + normalized_consequent).join(" ") - post.update(tag_string: tags) + post.tag_string += " " + consequent + post.save end end end diff --git a/test/unit/bulk_update_request_test.rb b/test/unit/bulk_update_request_test.rb index 9fef9d810..8cf6afc4e 100644 --- a/test/unit/bulk_update_request_test.rb +++ b/test/unit/bulk_update_request_test.rb @@ -326,7 +326,7 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase end should "update the tags" do - assert_equal("bar baz", @post.reload.tag_string) + assert_equal("bar baz foo", @post.reload.tag_string) assert_equal("approved", @bur.reload.status) assert_equal(User.system, @post.versions.last.updater) end @@ -575,7 +575,7 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase end should "process mass updates" do - assert_equal("bar baz bbb blah", @post.reload.tag_string) + assert_equal("aaa bar baz bbb blah", @post.reload.tag_string) end should "set the alias/implication approvers" do