Github issues迁移,用户名处理
This commit is contained in:
parent
0b21d4af41
commit
1eb18e4036
|
@ -178,13 +178,13 @@ namespace :batch_add_issues do
|
|||
user_login = user_login[0..20] if user_login.size > 29
|
||||
issue_created_at = issue['created_at']
|
||||
issue_updated_at = issue['updated_at']
|
||||
user = User.find_by(login: user_login)
|
||||
username = "gh-#{user_login}"
|
||||
user = User.find_by(login: username)
|
||||
unless user.present?
|
||||
username = "gh-#{user_login}"
|
||||
email = "#{username}@gitlink.org.cn"
|
||||
phone = ""
|
||||
password = "a12345678"
|
||||
user = User.new(nickname: user_login, login: username, mail: email, password: password, type: 'User', phone: phone)
|
||||
user = User.new(nickname: username, login: username, mail: email, password: password, type: 'User', phone: phone)
|
||||
interactor = Gitea::RegisterInteractor.call({ username: username, email: email, password: password })
|
||||
gitea_user = interactor.result
|
||||
result = Gitea::User::GenerateTokenService.call(username, password)
|
||||
|
@ -230,13 +230,13 @@ namespace :batch_add_issues do
|
|||
next if user_login.size >29
|
||||
comment_created_at = comment['created_at']
|
||||
comment_updated_at = comment['updated_at']
|
||||
comment_user = User.find_by(login: user_login)
|
||||
username = "gh-#{user_login}"
|
||||
comment_user = User.find_by(login: username)
|
||||
unless comment_user.present?
|
||||
username = "gh-#{user_login}"
|
||||
email = "#{username}@gitlink.org.cn"
|
||||
phone = ""
|
||||
password = "a12345678"
|
||||
comment_user = User.new(nickname: user_login, login: username, mail: email, password: password, type: 'User', phone: phone)
|
||||
comment_user = User.new(nickname: username, login: username, mail: email, password: password, type: 'User', phone: phone)
|
||||
interactor = Gitea::RegisterInteractor.call({ username: username, email: email, password: password })
|
||||
gitea_user = interactor.result
|
||||
result = Gitea::User::GenerateTokenService.call(username, password)
|
||||
|
|
Loading…
Reference in New Issue