mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: Importers should allow categories with existing name if the parent category is different
This changes the content of `@categories_lookup` from `Category` objects to IDs since the category names aren't needed anymore. The lookup method has been renamed too.
This commit is contained in:
parent
091af27a31
commit
b5426763e4
14 changed files with 27 additions and 31 deletions
|
@ -41,8 +41,7 @@ class ImportScripts::Kunena < ImportScripts::Base
|
|||
create_categories(@client.query("SELECT id, parent, name, description, ordering FROM jos_kunena_categories ORDER BY parent, id;")) do |c|
|
||||
h = {id: c['id'], name: c['name'], description: c['description'], position: c['ordering'].to_i}
|
||||
if c['parent'].to_i > 0
|
||||
parent = category_from_imported_category_id(c['parent'])
|
||||
h[:parent_category_id] = parent.id if parent
|
||||
h[:parent_category_id] = category_id_from_imported_category_id(c['parent'])
|
||||
end
|
||||
h
|
||||
end
|
||||
|
@ -121,7 +120,7 @@ class ImportScripts::Kunena < ImportScripts::Base
|
|||
mapped[:created_at] = Time.zone.at(m['time'])
|
||||
|
||||
if m['id'] == m['thread']
|
||||
mapped[:category] = category_from_imported_category_id(m['catid']).try(:name)
|
||||
mapped[:category] = category_id_from_imported_category_id(m['catid'])
|
||||
mapped[:title] = m['subject']
|
||||
else
|
||||
parent = topic_lookup_from_imported_post_id(m['parent'])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue