Merge pull request '调整转移仓库时的actions' (#313) from KingChan/forgeplus:pm_project_develop into pm_project_develop
This commit is contained in:
commit
b38a329584
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue