From 5d4aa256be3dde00e5026e93900de00165540dc6 Mon Sep 17 00:00:00 2001 From: MMX <4isNothing@gmail.com> Date: Mon, 29 Apr 2019 23:01:15 +0800 Subject: [PATCH] FIX: category logo upload error in Discuz importer.(#7453) --- script/import_scripts/discuz_x.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/import_scripts/discuz_x.rb b/script/import_scripts/discuz_x.rb index a575f2a84c8..71094ec46af 100644 --- a/script/import_scripts/discuz_x.rb +++ b/script/import_scripts/discuz_x.rb @@ -287,9 +287,9 @@ class ImportScripts::DiscuzX < ImportScripts::Base if !row['icon'].empty? upload = create_upload(Discourse::SYSTEM_USER_ID, File.join(DISCUZX_BASE_DIR, ATTACHMENT_DIR, '../common', row['icon']), File.basename(row['icon'])) if upload - category.uploaded_logo = upload + category.uploaded_logo_id = upload.id # FIXME: I don't know how to get '/shared' by script. May change to Rails.root - category.color = Miro::DominantColors.new(File.join('/shared', category.logo_url)).to_hex.first[1, 6] if !color + category.color = Miro::DominantColors.new(File.join('/shared', upload.url)).to_hex.first[1, 6] if !color category.save! end end @@ -345,6 +345,7 @@ class ImportScripts::DiscuzX < ImportScripts::Base mapped[:user_id] = user_id_from_imported_user_id(m['user_id']) || -1 mapped[:raw] = process_discuzx_post(m['raw'], m['id']) mapped[:created_at] = Time.zone.at(m['post_time']) + mapped[:tags] = m['tags'] if m['id'] == m['first_id'] mapped[:category] = category_id_from_imported_category_id(m['category_id'])