Fix #5153: Using the child metatag without an id causes unexpected behavior

This commit is contained in:
evazion
2022-05-04 22:26:09 -05:00
parent 4ba993319a
commit 34038d71ae
2 changed files with 36 additions and 4 deletions

View File

@@ -526,11 +526,15 @@ class Post < ApplicationRecord
end
in "-child", ids
next if ids.blank?
children.search(id: ids).each do |post|
post.update!(parent_id: nil)
end
in "child", ids
next if ids.blank?
Post.search(id: ids).where.not(id: id).limit(10).each do |post|
post.update!(parent_id: id)
end