forked from e621ng/e621ng
[BURs] Don't use tag_string_diff for tag nuking
This doesn't have the same issue as mass updates, but it doesn't hurt to change this away from tag_string_diff as well Aliases/Implications still do this but considering this has been the case for 4 years now I don't believe this to be a problem
This commit is contained in:
parent
ca56ef3529
commit
a816ee3b34
@ -28,7 +28,7 @@ class TagNukeJob < ApplicationJob
|
|||||||
Post.sql_raw_tag_match(tag_name).find_each do |post|
|
Post.sql_raw_tag_match(tag_name).find_each do |post|
|
||||||
post.with_lock do
|
post.with_lock do
|
||||||
post.do_not_version_changes = true
|
post.do_not_version_changes = true
|
||||||
post.tag_string_diff = "-#{tag_name}"
|
post.remove_tag(tag_name)
|
||||||
post.save
|
post.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -50,7 +50,7 @@ class TagNukeJob < ApplicationJob
|
|||||||
TagRelUndo.where(tag_rel: tag, applied: false).find_each do |tag_rel_undo|
|
TagRelUndo.where(tag_rel: tag, applied: false).find_each do |tag_rel_undo|
|
||||||
Post.where(id: tag_rel_undo.undo_data).find_each do |post|
|
Post.where(id: tag_rel_undo.undo_data).find_each do |post|
|
||||||
post.do_not_version_changes = true
|
post.do_not_version_changes = true
|
||||||
post.tag_string_diff = tag.name
|
post.add_tag(tag.name)
|
||||||
post.save
|
post.save
|
||||||
end
|
end
|
||||||
tag_rel_undo.update(applied: true)
|
tag_rel_undo.update(applied: true)
|
||||||
|
@ -12,4 +12,13 @@ class TagNukeJobTest < ActiveJob::TestCase
|
|||||||
assert_equal("aa b c", p1.tag_string)
|
assert_equal("aa b c", p1.tag_string)
|
||||||
assert_equal("dd y z", p2.tag_string)
|
assert_equal("dd y z", p2.tag_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "ignore aliases" do
|
||||||
|
CurrentUser.user = create(:user)
|
||||||
|
post = create(:post, tag_string: "extra new_tag")
|
||||||
|
create(:tag_alias, antecedent_name: "old_tag", consequent_name: "new_tag", status: "active")
|
||||||
|
TagNukeJob.perform_now("old_tag", CurrentUser.user.id)
|
||||||
|
|
||||||
|
assert_equal("extra new_tag", post.reload.tag_string)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user