mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
DEV: Apply rubocop to script/import_scripts/phorum.rb (#14727)
Followup to b24002018a10e12b7bdee3a8f5218345716af6ff
This commit is contained in:
@ -25,7 +25,7 @@ class ImportScripts::Phorum < ImportScripts::Base
|
|||||||
import_users
|
import_users
|
||||||
import_categories
|
import_categories
|
||||||
import_posts
|
import_posts
|
||||||
import_attachments
|
import_attachments
|
||||||
end
|
end
|
||||||
|
|
||||||
def import_users
|
def import_users
|
||||||
@ -209,7 +209,7 @@ class ImportScripts::Phorum < ImportScripts::Base
|
|||||||
s.gsub!(/\[\/color\]/i, "")
|
s.gsub!(/\[\/color\]/i, "")
|
||||||
|
|
||||||
s.gsub!(/\[hr\]/i, "<hr>")
|
s.gsub!(/\[hr\]/i, "<hr>")
|
||||||
|
|
||||||
# remove trailing <br>
|
# remove trailing <br>
|
||||||
s = s.chomp("<br>")
|
s = s.chomp("<br>")
|
||||||
|
|
||||||
@ -229,12 +229,12 @@ class ImportScripts::Phorum < ImportScripts::Base
|
|||||||
where message_id > 0
|
where message_id > 0
|
||||||
order by file_id
|
order by file_id
|
||||||
SQL
|
SQL
|
||||||
|
|
||||||
current_count = 0
|
current_count = 0
|
||||||
total_count = uploads.count
|
total_count = uploads.count
|
||||||
|
|
||||||
uploads.each do |upload|
|
uploads.each do |upload|
|
||||||
|
|
||||||
# puts "*** processing file #{upload['file_id']}"
|
# puts "*** processing file #{upload['file_id']}"
|
||||||
|
|
||||||
post_id = post_id_from_imported_post_id(upload['message_id'])
|
post_id = post_id_from_imported_post_id(upload['message_id'])
|
||||||
@ -256,8 +256,8 @@ class ImportScripts::Phorum < ImportScripts::Base
|
|||||||
}
|
}
|
||||||
|
|
||||||
upl_obj = create_upload(post.user.id, filename, real_filename)
|
upl_obj = create_upload(post.user.id, filename, real_filename)
|
||||||
|
|
||||||
# puts "discourse post #{post['id']} and upload #{upl_obj['id']}"
|
# puts "discourse post #{post['id']} and upload #{upl_obj['id']}"
|
||||||
|
|
||||||
if upl_obj&.persisted?
|
if upl_obj&.persisted?
|
||||||
html = html_for_upload(upl_obj, real_filename)
|
html = html_for_upload(upl_obj, real_filename)
|
||||||
@ -282,7 +282,7 @@ class ImportScripts::Phorum < ImportScripts::Base
|
|||||||
print_status(current_count, total_count)
|
print_status(current_count, total_count)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
ImportScripts::Phorum.new.perform
|
ImportScripts::Phorum.new.perform
|
||||||
|
Reference in New Issue
Block a user