add TransferService update actions

This commit is contained in:
kingChan 2024-06-27 14:43:13 +08:00
parent a384e129c6
commit 499473c296
1 changed files with 11 additions and 0 deletions

View File

@ -10,6 +10,7 @@ class Projects::TransferService < ApplicationService
def call
Rails.logger.info("###### Project transfer_service begin ######")
ActiveRecord::Base.transaction do
update_actions
gitea_update_owner
update_owner
update_repo_url
@ -31,6 +32,16 @@ class Projects::TransferService < ApplicationService
project.set_owner_permission(new_owner)
end
def update_actions
begin
action_params = { has_actions: false }
Gitea::Repository::UpdateService.call(owner&.login, project.identifier, action_params)
project.update action_params
rescue Exception => e
Rails.logger.info("##### Project transfer_service, gitea transfer error #{e}")
end
end
def update_repo_url
project.repository.update!(user_id: new_owner.id, url: @gitea_repo["clone_url"])
end