上传文件返回pull_request_id

This commit is contained in:
sylor_huang@126.com 2020-06-05 10:57:46 +08:00
parent ba93347df8
commit c5c3294bda
6 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,5 @@
class JournalsController < ApplicationController
before_action :require_login, except: :index
before_action :require_login, except: [:index, :get_children_journals]
before_action :set_issue
before_action :check_issue_permission
before_action :set_journal, only: [:destroy, :edit, :update]

View File

@ -207,8 +207,8 @@ class RepositoriesController < ApplicationController
status_id: 1,
priority_id: 1
}
pull_issue = Issue.new(issue_params)
if pull_issue.save!
@pull_issue = Issue.new(issue_params)
if @pull_issue.save!
local_requests = PullRequest.new(local_params.merge(user_id: current_user.try(:id), project_id: @project.id, issue_id: pull_issue.id))
if local_requests.save
gitea_request = Gitea::PullRequest::CreateService.new(current_user.try(:gitea_token), @project.owner, @project.try(:identifier), requests_params).call

View File

@ -53,7 +53,7 @@ module Gitea
def file_params
file_params = {}
file_params = file_params.merge(branch: @params[:branch]) unless (@params[:branch].blank? || @params[:new_branch].present?)
file_params = file_params.merge(branch: @params[:branch]) unless @params[:branch].blank?
file_params = file_params.merge(new_branch: @params[:new_branch]) unless @params[:new_branch].blank?
file_params = file_params.merge(content: Base64.encode64(@params[:content]))
file_params = file_params.merge(message: @params[:message]) unless @params[:message].blank?

View File

@ -3,6 +3,7 @@ json.sha @file['content']['sha']
json.size @file['content']['size']
json.content @file['content']['content']
json.encoding @file['content']['encoding']
json.pr_id @pull_issue.try(:id)
json.commit do
json.message @file['commit']['message']
json.author @file['commit']['author']

View File

@ -3,6 +3,7 @@ json.sha @file['content']['sha']
json.size @file['content']['size']
json.content @file['content']['content']
json.encoding @file['content']['encoding']
json.pr_id @pull_issue.try(:id)
json.commit do
json.message @file['commit']['message']
json.author @file['commit']['author']

BIN
dump.rdb

Binary file not shown.