mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Fix username conversion. Add comments.
This commit is contained in:
parent
a552170766
commit
7c2927f8ab
@ -153,15 +153,18 @@ class ImportScripts::MyBB < ImportScripts::Base
|
|||||||
puts '', "banned users are not implemented"
|
puts '', "banned users are not implemented"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Discourse usernames don't allow spaces
|
||||||
def convert_username(username, post_id)
|
def convert_username(username, post_id)
|
||||||
count = 0
|
count = 0
|
||||||
username.gsub!(' ') { |a| count += 1; ' ' }
|
username.gsub!(' ') { |a| count += 1; '_' }
|
||||||
|
# Warn on MyBB bug that places post text in the quote line - http://community.mybb.com/thread-180526.html
|
||||||
if count > 5
|
if count > 5
|
||||||
puts "Warning: probably incorrect quote in post #{post_id}"
|
puts "Warning: probably incorrect quote in post #{post_id}"
|
||||||
end
|
end
|
||||||
return username
|
return username
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Take an original post id and return the migrated topic id and post number for it
|
||||||
def post_id_to_post_num_and_topic(quoted_post_id, post_id)
|
def post_id_to_post_num_and_topic(quoted_post_id, post_id)
|
||||||
quoted_post_id_from_imported = post_id_from_imported_post_id(quoted_post_id.to_i)
|
quoted_post_id_from_imported = post_id_from_imported_post_id(quoted_post_id.to_i)
|
||||||
if quoted_post_id_from_imported
|
if quoted_post_id_from_imported
|
||||||
|
Loading…
Reference in New Issue
Block a user