BURs: fix mass update A -> B not being allowed.

Fix mass updates of the form `mass update A -> B` not being allowed.

This was originally because after `rename` was introduced, we wanted to
prevent people from using mass updates to move tags. Now, `mass update A -> B`
adds B to all posts tagged A instead of moving A to B. So `mass update A -> B`
should no longer be disallowed.

This also makes it so that it's an error to create a mass update with a
syntax error in the search. Before searches couldn't have syntax errors,
but now with the new query parser it's possible.
This commit is contained in:
evazion
2022-03-29 21:31:28 -05:00
parent 226faae8ec
commit fb0a7851bf
3 changed files with 16 additions and 7 deletions

View File

@@ -339,11 +339,11 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
assert_equal("approved", @bur.reload.status)
end
should "not allow mass update for simple A -> B moves" do
@bur = build(:bulk_update_request, script: "mass update bunny -> rabbit")
should "not allow invalid searches in mass updates" do
@bur = build(:bulk_update_request, script: "mass update (foo -> bar")
assert_equal(false, @bur.valid?)
assert_equal(["Can't mass update bunny -> rabbit (use an alias or a rename instead for tag moves)"], @bur.errors.full_messages)
assert_equal(["Can't mass update (foo -> bar (the search `(foo` has a syntax error)"], @bur.errors.full_messages)
end
end