v0.16.4 Profile image handling improvement
This commit is contained in:
parent
c384aebed5
commit
04bca84117
@ -1,5 +1,5 @@
|
||||
# gossamer threads migration-import code
|
||||
# v0.16.3
|
||||
# v0.16.4
|
||||
|
||||
require 'mysql2'
|
||||
require 'open-uri'
|
||||
@ -501,11 +501,14 @@ class GossamerForumsImporter < ImportScripts::Base
|
||||
|
||||
puts "#E"
|
||||
|
||||
# Append the image to the user's bio
|
||||
user.user_profile.bio_raw ||= ""
|
||||
user.user_profile.bio_raw += "\n\n![#{file['File_Name']}](#{file_url})"
|
||||
user.user_profile.save!
|
||||
|
||||
# Append the image to the user's bio_raw only if it does not already exist
|
||||
image_markdown = "\n\n![#{file['File_Name']}](#{file_url})"
|
||||
user.user_profile.bio_raw ||= ""
|
||||
unless user.user_profile.bio_raw.include?(image_markdown)
|
||||
user.user_profile.bio_raw += image_markdown
|
||||
user.user_profile.save!
|
||||
end
|
||||
|
||||
# Clean up temporary files
|
||||
temp_file.close
|
||||
temp_file.unlink
|
||||
|
Loading…
Reference in New Issue
Block a user