Merge branch 'develop' into standalone_develop

This commit is contained in:
yystopf 2023-03-31 17:24:14 +08:00
commit ea26c2f559
1 changed files with 8 additions and 4 deletions

View File

@ -30,7 +30,7 @@ class Api::V1::Users::UpdateEmailService < ApplicationService
ActiveRecord::Base.transaction do
change_user_email
excute_data_to_gitea
excute_change_email_from_gitea
excute_change_email_from_gitea
remove_old_cache_for_user
end
@ -61,13 +61,17 @@ class Api::V1::Users::UpdateEmailService < ApplicationService
end
def excute_data_to_gitea
Rails.logger.info request_body
@gitea_data = $gitea_client.patch_admin_users_by_username(@user.login, {body: request_body.to_json})
end
def excute_change_email_from_gitea
$gitea_client.delete_user_emails({body: {emails: [@old_mail]}.to_json, query: request_params})
$gitea_client.post_user_emails({body: {emails: [@mail]}.to_json, query: request_params})
emails = $gitea_client.get_user_emails({query: request_params})
puts "emails=#{emails}"
emails.each do |email|
email = email.stringify_keys
next if email["email"] == @mail
$gitea_client.delete_user_emails({body: {emails: [email["email"]]}.to_json, query: request_params})
end
end
def remove_old_cache_for_user