Fix #4483: Wrong order for BUR caused 12k mistags.

Bug: if a BUR contained a mass update followed by an alias, then the
alias would become active before the mass update, which could cause
the mass update to return incorrect results if both the alias and mass
update touched the same tags.

This happened because all aliases and implications in the BUR were set
to a queued state before the mass update was processed, but putting an
alias in the queued state effectively made it active.

The fix is to remove the queued state. This was only used anyway as a
debugging tool anyway to monitor the state of BURs as they were being
processed.
This commit is contained in:
evazion
2020-11-12 15:59:01 -06:00
parent cc64f8b7ee
commit 9a287cd71f
11 changed files with 56 additions and 50 deletions

View File

@@ -226,6 +226,20 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
end
end
end
context "that contains a mass update followed by an alias" do
should "make the alias take effect after the mass update" do
@bur = create(:bulk_update_request, script: "mass update maid_dress -> maid dress\nalias maid_dress -> maid")
@p1 = create(:post, tag_string: "maid_dress")
@p2 = create(:post, tag_string: "maid")
@bur.approve!(@admin)
perform_enqueued_jobs
assert_equal("dress maid", @p1.reload.tag_string)
assert_equal("maid", @p2.reload.tag_string)
end
end
end
context "when validating a script" do