FIX: Use max_category_nesting when importing categories (#13105)

It allowed for a parent category and a sub-category.
This commit is contained in:
Bianca Nenciu 2021-05-26 12:40:26 +03:00 committed by GitHub
parent 96f3f15f38
commit d0779a87bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -430,7 +430,7 @@ class ImportScripts::Base
# make sure categories don't go more than 2 levels deep
if params[:parent_category_id]
top = Category.find_by_id(params[:parent_category_id])
top = top.parent_category while top && !top.parent_category.nil?
top = top.parent_category while (top&.height_of_ancestors || -1) + 1 >= SiteSetting.max_category_nesting
params[:parent_category_id] = top.id if top
end