aliases/implications: remove 'pending' state.

Remove the pending status from tag aliases and implications.

Previously aliases would be created first in the pending state then
changed to active when the alias was later processed in a delayed job.
This meant that BURs weren't processed completely sequentially; first
all the aliases in a BUR would be created in one go, then later they
would be processed and set to active sequentially.

This was problematic in complex BURs that tried to reverse or swap
around aliases, since new pending aliases could be created before old
conflicting aliases were removed.
This commit is contained in:
evazion
2020-12-01 15:30:42 -06:00
parent 45d050d918
commit 8717c319ab
19 changed files with 70 additions and 114 deletions

View File

@@ -156,12 +156,14 @@ class BulkUpdateRequestsControllerTest < ActionDispatch::IntegrationTest
create(:tag, name: "artist2a", category: Tag.categories.artist, post_count: 20)
@bulk_update_request = create(:bulk_update_request, script: "mass update artist1a -> artist1b\ncreate alias artist2a -> artist2b")
post_auth approve_bulk_update_request_path(@bulk_update_request), @builder
perform_enqueued_jobs do
post_auth approve_bulk_update_request_path(@bulk_update_request), @builder
end
assert_redirected_to(bulk_update_requests_path)
assert_equal("approved", @bulk_update_request.reload.status)
assert_equal(@builder, @bulk_update_request.approver)
assert_equal(true, TagAlias.where(antecedent_name: "artist2a", consequent_name: "artist2b").exists?)
assert_equal(true, TagAlias.exists?(antecedent_name: "artist2a", consequent_name: "artist2b", status: "active"))
end
end