fix so the generic importer works with already exisiting categories
This commit is contained in:
parent
0572d752be
commit
1008a064ee
|
@ -1356,12 +1356,14 @@ class BulkImport::Base
|
|||
def process_category(category)
|
||||
if (existing_category_id = category[:existing_id]).present?
|
||||
if existing_category_id.is_a?(String)
|
||||
existing_category_id = SiteSetting.get(category[:existing_id])
|
||||
existing_category_id = Category.find_by(id: category[:existing_id])&.id
|
||||
end
|
||||
|
||||
@categories[category[:imported_id].to_i] = existing_category_id
|
||||
category[:skip] = true
|
||||
return category
|
||||
if existing_category_id
|
||||
@categories[category[:imported_id].to_i] = existing_category_id
|
||||
category[:skip] = true
|
||||
return category
|
||||
end
|
||||
end
|
||||
|
||||
category[:id] ||= @last_category_id += 1
|
||||
|
|
Loading…
Reference in New Issue