From 5c4534d895d7ed6cd45959cdb5d8b9324b88e15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9gis=20Hanol?= Date: Thu, 12 Jul 2018 16:55:30 +0200 Subject: [PATCH] Update SMF1 import - Properly import avatar when they use an external image - Don't import the same attachment twice --- script/import_scripts/smf1.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script/import_scripts/smf1.rb b/script/import_scripts/smf1.rb index a8c5207c305..b2f1e59d6a4 100644 --- a/script/import_scripts/smf1.rb +++ b/script/import_scripts/smf1.rb @@ -113,6 +113,7 @@ class ImportScripts::Smf1 < ImportScripts::Base , memberIP2 , is_activated , additionalGroups + , avatar , id_attach , attachmentType , filename @@ -167,7 +168,9 @@ class ImportScripts::Smf1 < ImportScripts::Base end # avatar - avatar_url = if u["attachmentType"] == 0 && u["id_attach"].present? + avatar_url = if u["avatar"].present? + u["avatar"] + elsif u["attachmentType"] == 0 && u["id_attach"].present? "#{FORUM_URL}/index.php?action=dlattach;attach=#{u["id_attach"]};type=avatar" elsif u["attachmentType"] == 1 && u["filename"].present? "#{FORUM_URL}/avatar-members/#{u["filename"]}" @@ -402,7 +405,7 @@ class ImportScripts::Smf1 < ImportScripts::Base if upload = create_upload(post.user_id, path, u["filename"]) html = html_for_upload(upload, u["filename"]) - unless post.raw[html] + unless post.raw[html] || PostUpload.where(upload: upload, post: post).exists? post.raw += "\n\n#{html}\n\n" post.save PostUpload.create(upload: upload, post: post)