From 1eb18e4036196859fa94b39e234aae508ad098fc Mon Sep 17 00:00:00 2001 From: xxq250 Date: Fri, 15 Dec 2023 15:47:41 +0800 Subject: [PATCH] =?UTF-8?q?Github=20issues=E8=BF=81=E7=A7=BB,=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/batch_add_issues.rake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/tasks/batch_add_issues.rake b/lib/tasks/batch_add_issues.rake index 3b6073958..b30925f31 100644 --- a/lib/tasks/batch_add_issues.rake +++ b/lib/tasks/batch_add_issues.rake @@ -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)