v0.15.4 Minor fix

This commit is contained in:
David Sainty 2024-06-26 21:01:52 +10:00
parent c9f55a0e87
commit 5e82e5e3d1

View File

@ -1,5 +1,5 @@
# gossamer threads migration-import code # gossamer threads migration-import code
# v0.15.3 # v0.15.4
require 'mysql2' require 'mysql2'
require 'open-uri' require 'open-uri'
@ -145,9 +145,11 @@ class GossamerForumsImporter < ImportScripts::Base
existing_user = User.find_by(username: sanitized_username) existing_user = User.find_by(username: sanitized_username)
if existing_user if existing_user
if existing_user.email.downcase == email.downcase && existing_user.name == name if existing_user.email.downcase == email.downcase && existing_user.name == real_name
# The existing user with the username the same as the current proposed sanitised name _is_ the same person...
return sanitized_username return sanitized_username
else else
# We cannot clobber another person with the same proposed username, so we resolve the conflict
counter = 1 counter = 1
while User.exists?(username: sanitized_username) while User.exists?(username: sanitized_username)
sanitized_username = "#{firststep_sanitized}_#{counter}" sanitized_username = "#{firststep_sanitized}_#{counter}"