Merge branch 'dev_trustie' into dev_devops

This commit is contained in:
sylor_huang@126.com 2020-08-15 15:04:24 +08:00
commit 8fd167b578
1 changed files with 3 additions and 15 deletions

View File

@ -61,30 +61,18 @@ class PullRequestsController < ApplicationController
merge_params
pull_issue = Issue.new(@issue_params)
if pull_issue.save!
if params[:fork_project_id].present?
_fork_project = @project.fork_project
end
pr_params = {
user_id: current_user.try(:id),
project_id: @project.id,
issue_id: pull_issue.id,
fork_project_id: _fork_project&.id,
fork_project_id: params[:fork_project_id],
is_original: params[:is_original]
}
local_requests = PullRequest.new(@local_params.merge(pr_params))
if local_requests.save
remote_pr_params = @local_params
if local_requests.is_original && params[:merge_user_login]
remote_pr_params = remote_pr_params.merge(head: "#{params[:merge_user_login]}:#{params[:head]}").compact
gitea_request = Gitea::PullRequest::CreateService.call(current_user.try(:gitea_token), _fork_project&.owner, _fork_project.try(:identifier), remote_pr_params.except(:milestone))
else
gitea_request = Gitea::PullRequest::CreateService.call(current_user.try(:gitea_token), @project.owner, @repository.try(:identifier), remote_pr_params.except(:milestone))
end
#remote_pr_params = remote_pr_params.merge(head: "#{params[:merge_user_login]}:#{params[:head]}").compact if local_requests.is_original && params[:merge_user_login]
#gitea_request = Gitea::PullRequest::CreateService.call(current_user.try(:gitea_token), @project.owner, @repository.try(:identifier), remote_pr_params.except(:milestone))
remote_pr_params = remote_pr_params.merge(head: "#{params[:merge_user_login]}:#{params[:head]}").compact if local_requests.is_original && params[:merge_user_login]
gitea_request = Gitea::PullRequest::CreateService.call(current_user.try(:gitea_token), @project.owner, @repository.try(:identifier), remote_pr_params.except(:milestone))
if gitea_request && local_requests.update_attributes(gpid: gitea_request["number"])
if params[:issue_tag_ids].present?
params[:issue_tag_ids].each do |tag|