Skip to content

A platform for community discussion. Free, open, simple.

Update SMF1 import

Régis Hanol5c4534d895d7
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)