BURs: fix tag nukes not removing antecedent implications.
Fix a bug where if A implied B, and A was nuked, then the A->B implication wasn't removed.
This commit is contained in:
@@ -158,6 +158,7 @@ class BulkUpdateRequestProcessor
|
|||||||
# otherwise the tag won't be removed from posts that have those other tags
|
# otherwise the tag won't be removed from posts that have those other tags
|
||||||
if PostQueryBuilder.new(args[0]).is_simple_tag?
|
if PostQueryBuilder.new(args[0]).is_simple_tag?
|
||||||
TagImplication.active.where(consequent_name: args[0]).each { |ti| ti.reject!(User.system) }
|
TagImplication.active.where(consequent_name: args[0]).each { |ti| ti.reject!(User.system) }
|
||||||
|
TagImplication.active.where(antecedent_name: args[0]).each { |ti| ti.reject!(User.system) }
|
||||||
end
|
end
|
||||||
|
|
||||||
TagBatchChangeJob.perform_later(args[0], "-#{args[0]}")
|
TagBatchChangeJob.perform_later(args[0], "-#{args[0]}")
|
||||||
|
|||||||
@@ -327,10 +327,12 @@ class BulkUpdateRequestTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
should "remove implications" do
|
should "remove implications" do
|
||||||
@ti = create(:tag_implication, antecedent_name: "foo", consequent_name: "bar")
|
@ti1 = create(:tag_implication, antecedent_name: "fly", consequent_name: "insect")
|
||||||
create_bur!("nuke bar", @admin)
|
@ti2 = create(:tag_implication, antecedent_name: "insect", consequent_name: "bug")
|
||||||
|
create_bur!("nuke insect", @admin)
|
||||||
|
|
||||||
assert_equal("deleted", @ti.reload.status)
|
assert_equal("deleted", @ti1.reload.status)
|
||||||
|
assert_equal("deleted", @ti2.reload.status)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "remove pools" do
|
should "remove pools" do
|
||||||
|
|||||||
Reference in New Issue
Block a user