Update SMF1 import
- Properly import avatar when they use an external image - Don't import the same attachment twice
This commit is contained in:
parent
6bc0f97668
commit
5c4534d895
|
@ -113,6 +113,7 @@ class ImportScripts::Smf1 < ImportScripts::Base
|
||||||
, memberIP2
|
, memberIP2
|
||||||
, is_activated
|
, is_activated
|
||||||
, additionalGroups
|
, additionalGroups
|
||||||
|
, avatar
|
||||||
, id_attach
|
, id_attach
|
||||||
, attachmentType
|
, attachmentType
|
||||||
, filename
|
, filename
|
||||||
|
@ -167,7 +168,9 @@ class ImportScripts::Smf1 < ImportScripts::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# avatar
|
# 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"
|
"#{FORUM_URL}/index.php?action=dlattach;attach=#{u["id_attach"]};type=avatar"
|
||||||
elsif u["attachmentType"] == 1 && u["filename"].present?
|
elsif u["attachmentType"] == 1 && u["filename"].present?
|
||||||
"#{FORUM_URL}/avatar-members/#{u["filename"]}"
|
"#{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"])
|
if upload = create_upload(post.user_id, path, u["filename"])
|
||||||
html = html_for_upload(upload, 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.raw += "\n\n#{html}\n\n"
|
||||||
post.save
|
post.save
|
||||||
PostUpload.create(upload: upload, post: post)
|
PostUpload.create(upload: upload, post: post)
|
||||||
|
|
Loading…
Reference in New Issue