posts: don't reparent children when expunging posts.

If an expunged post has children, just set their parent to null instead
of reparenting them. Before we reparented them to the oldest child.
This commit is contained in:
evazion
2020-08-04 12:28:20 -05:00
parent b57122cf7f
commit f9aa1e9718
2 changed files with 1 additions and 24 deletions

View File

@@ -254,17 +254,6 @@ class PostTest < ActiveSupport::TestCase
end
end
should "reparent all children to the first child" do
@p1.expunge!
@c1.reload
@c2.reload
@c3.reload
assert_nil(@c1.parent_id)
assert_equal(@c1.id, @c2.parent_id)
assert_equal(@c1.id, @c3.parent_id)
end
should "save a post version record for each child" do
assert_difference(["@c1.versions.count", "@c2.versions.count", "@c3.versions.count"]) do
@p1.expunge!
@@ -273,11 +262,6 @@ class PostTest < ActiveSupport::TestCase
@c3.reload
end
end
should "set the has_children flag on the new parent" do
@p1.expunge!
assert_equal(true, @c1.reload.has_children?)
end
end
end