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
|
def call
|
||||||
Rails.logger.info("###### Project transfer_service begin ######")
|
Rails.logger.info("###### Project transfer_service begin ######")
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
|
update_actions
|
||||||
gitea_update_owner
|
gitea_update_owner
|
||||||
update_owner
|
update_owner
|
||||||
update_repo_url
|
update_repo_url
|
||||||
|
@ -31,6 +32,16 @@ class Projects::TransferService < ApplicationService
|
||||||
project.set_owner_permission(new_owner)
|
project.set_owner_permission(new_owner)
|
||||||
end
|
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
|
def update_repo_url
|
||||||
project.repository.update!(user_id: new_owner.id, url: @gitea_repo["clone_url"])
|
project.repository.update!(user_id: new_owner.id, url: @gitea_repo["clone_url"])
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue