mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
新增:存储pull_request源仓库信息
This commit is contained in:
@@ -15,6 +15,7 @@ class Projects::TransferService < ApplicationService
|
||||
update_repo_url
|
||||
update_visit_teams
|
||||
update_fork_info
|
||||
update_fork_pull_request_info
|
||||
end
|
||||
|
||||
Rails.logger.info("##### Project transfer_service end ######")
|
||||
@@ -49,6 +50,11 @@ class Projects::TransferService < ApplicationService
|
||||
fork_user.update(user_id: @new_owner.id) if fork_user.present?
|
||||
end
|
||||
|
||||
def update_fork_pull_request_info
|
||||
fork_pull_requests = PullRequest.where(fork_project_id: @project.id)
|
||||
fork_pull_requests.update_all(fork_project_owner: @new_owner&.login) if fork_pull_requests.present?
|
||||
end
|
||||
|
||||
def gitea_update_owner
|
||||
begin
|
||||
@gitea_repo = $gitea_hat_client.post_repos_transfer_by_owner_repo(owner&.login, project.identifier, {body: {new_owner: new_owner&.login}.to_json})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class PullRequests::CreateService < ApplicationService
|
||||
|
||||
attr_reader :current_user, :owner, :project, :params
|
||||
attr_reader :current_user, :owner, :project, :params, :fork_project
|
||||
attr_accessor :pull_issue, :pull_request
|
||||
|
||||
def initialize(current_user, owner, project, params)
|
||||
@@ -8,6 +8,7 @@ class PullRequests::CreateService < ApplicationService
|
||||
@project = project
|
||||
@params = params
|
||||
@current_user = current_user
|
||||
@fork_project = Project.find_by_id(params[:fork_project_id])
|
||||
end
|
||||
|
||||
def call
|
||||
@@ -102,7 +103,9 @@ class PullRequests::CreateService < ApplicationService
|
||||
fork_project_id: @params[:fork_project_id],
|
||||
is_original: is_original,
|
||||
files_count: @params[:files_count] || 0,
|
||||
commits_count: @params[:commits_count] || 0
|
||||
commits_count: @params[:commits_count] || 0,
|
||||
fork_project_owner: @fork_project&.owner&.login,
|
||||
fork_project_identifier: @fork_project&.identifier
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user