diff --git a/script/import_scripts/jive.rb b/script/import_scripts/jive.rb
index 2f45ac40f7a..c64e87a66bb 100644
--- a/script/import_scripts/jive.rb
+++ b/script/import_scripts/jive.rb
@@ -287,6 +287,37 @@ class ImportScripts::Jive < ImportScripts::Base
thread_map[thread.threadid] = thread.messageid
+ #IMAGE UPLOADER
+ if thread.imagecount
+ Dir.foreach("/var/www/discourse/script/import_scripts/jive/img/#{thread.messageid}") do |item|
+ next if item == '.' or item == '..' or item == '.DS_Store'
+ photo_path = "/var/www/discourse/script/import_scripts/jive/img/#{thread.messageid}/#{item}"
+ upload = create_upload(thread.userid, photo_path, File.basename(photo_path))
+ if upload.persisted?
+ puts "Image upload is successful for #{photo_path}, new path is #{upload.url}!"
+ thread.body.gsub!(item,upload.url)
+ else
+ puts "Error: Image upload is not successful for #{photo_path}!"
+ end
+ end
+ end
+
+ #ATTACHMENT UPLOADER
+ if thread.attachmentcount
+ Dir.foreach("/var/www/discourse/script/import_scripts/jive/attach/#{thread.messageid}") do |item|
+ next if item == '.' or item == '..' or item == '.DS_Store'
+ attach_path = "/var/www/discourse/script/import_scripts/jive/attach/#{thread.messageid}/#{item}"
+ upload = create_upload(thread.userid, attach_path, File.basename(attach_path))
+ if upload.persisted?
+ puts "Attachment upload is successful for #{attach_path}, new path is #{upload.url}!"
+ thread.body.gsub!(item,upload.url)
+ thread.body << "
#{attachment_html(upload,item)}"
+ else
+ puts "Error: Attachment upload is not successful for #{attach_path}!"
+ end
+ end
+ end
+
topic_map[thread.messageid] = {
id: thread.messageid,
topic_id: thread.messageid,
@@ -315,6 +346,38 @@ class ImportScripts::Jive < ImportScripts::Base
next unless CATEGORY_IDS.include?(thread.containerid.to_i)
if thread.parentmessageid
+
+ #IMAGE UPLOADER
+ if thread.imagecount
+ Dir.foreach("/var/www/discourse/script/import_scripts/jive/img/#{thread.messageid}") do |item|
+ next if item == '.' or item == '..' or item == '.DS_Store'
+ photo_path = "/var/www/discourse/script/import_scripts/jive/img/#{thread.messageid}/#{item}"
+ upload = create_upload(thread.userid, photo_path, File.basename(photo_path))
+ if upload.persisted?
+ puts "Image upload is successful for #{photo_path}, new path is #{upload.url}!"
+ thread.body.gsub!(item,upload.url)
+ else
+ puts "Error: Image upload is not successful for #{photo_path}!"
+ end
+ end
+ end
+
+ #ATTACHMENT UPLOADER
+ if thread.attachmentcount
+ Dir.foreach("/var/www/discourse/script/import_scripts/jive/attach/#{thread.messageid}") do |item|
+ next if item == '.' or item == '..' or item == '.DS_Store'
+ attach_path = "/var/www/discourse/script/import_scripts/jive/attach/#{thread.messageid}/#{item}"
+ upload = create_upload(thread.userid, attach_path, File.basename(attach_path))
+ if upload.persisted?
+ puts "Attachment upload is successful for #{attach_path}, new path is #{upload.url}!"
+ thread.body.gsub!(item,upload.url)
+ thread.body << "
#{attachment_html(upload,item)}"
+ else
+ puts "Error: Attachment upload is not successful for #{attach_path}!"
+ end
+ end
+ end
+
row = {
id: thread.messageid,
topic_id: thread_map["#{thread.threadid}"],