Merge branch 'sync_develop' into develop
This commit is contained in:
commit
203624a615
|
@ -136,7 +136,8 @@ class PullRequestsController < ApplicationController
|
|||
def show
|
||||
@issue_user = @issue.user
|
||||
@issue_assign_to = @issue.get_assign_user
|
||||
|
||||
@gitea_pull = Gitea::PullRequest::GetService.call(@owner.login,
|
||||
@repository.identifier, @pull_request.gpid, current_user&.gitea_token)
|
||||
end
|
||||
|
||||
def pr_merge
|
||||
|
|
|
@ -53,6 +53,18 @@ class RepositoriesController < ApplicationController
|
|||
@entries = Gitea::Repository::Entries::ListService.new(@owner, @project.identifier, ref: @ref).call
|
||||
@entries = @entries.present? ? @entries.sort_by{ |hash| hash['type'] } : []
|
||||
@path = Gitea.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/"
|
||||
|
||||
# TODO
|
||||
# 临时处理readme文件问题
|
||||
admin = current_user.blank? ? User.where(admin: true).last : current_user
|
||||
|
||||
result = Gitea::Repository::Readme::GetService.call(@owner.login, @project.identifier, @ref, admin&.gitea_token)
|
||||
@readme =
|
||||
if result[:status] == :success
|
||||
result[:body]
|
||||
else
|
||||
{}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
# Get a pull request
|
||||
class Gitea::PullRequest::GetService < Gitea::ClientService
|
||||
attr_reader :user, :repo, :pull_request_id
|
||||
attr_reader :owner, :repo, :number, :token
|
||||
|
||||
# user: 用户
|
||||
# repo: 仓库名称/标识
|
||||
# pull_request_id: pull request主键id
|
||||
def initialize(user, repo, pull_request_id)
|
||||
super({token: user.gitea_token})
|
||||
@user = user
|
||||
#eq:
|
||||
# Gitea::PullRequest::GetService.call(user.login, repository.identifier, pull.gpid, user.gitea_token)
|
||||
def initialize(owner, repo, number, token=nil)
|
||||
@owner = owner
|
||||
@repo = repo
|
||||
@pull_request_id = pull_request_id
|
||||
@number = number
|
||||
@token = token
|
||||
end
|
||||
|
||||
def call
|
||||
|
@ -19,11 +18,11 @@ class Gitea::PullRequest::GetService < Gitea::ClientService
|
|||
|
||||
private
|
||||
def params
|
||||
Hash.new.merge(token: user.gitea_token)
|
||||
Hash.new.merge(token: token)
|
||||
end
|
||||
|
||||
def url
|
||||
"/repos/#{user.login}/#{repo}/pulls/#{pull_request_id}".freeze
|
||||
"/repos/#{owner}/#{repo}/pulls/#{number}".freeze
|
||||
end
|
||||
|
||||
def render_result(response)
|
||||
|
@ -31,7 +30,7 @@ class Gitea::PullRequest::GetService < Gitea::ClientService
|
|||
when 200
|
||||
JSON.parse(response.body)
|
||||
else
|
||||
nil
|
||||
{}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ class Issues::ListQueryService < ApplicationService
|
|||
end
|
||||
|
||||
if search_name.present?
|
||||
issues = issues.where("subject like ?", "%#{search_name}%")
|
||||
issues = issues.where("subject LIKE ? OR description LIKE ? ", "%#{search_name}%", "%#{search_name}%")
|
||||
end
|
||||
|
||||
if start_time&.present? || end_time&.present?
|
||||
|
|
|
@ -12,6 +12,8 @@ json.pull_request do
|
|||
json.pull_request_staus @pull_request.status == 1 ? "merged" : (@pull_request.status == 2 ? "closed" : "open")
|
||||
json.fork_project_user @pull_request&.fork_project&.owner.try(:login)
|
||||
json.create_user @pull_request&.user&.login
|
||||
json.mergeable @gitea_pull["mergeable"]
|
||||
json.state @gitea_pull["state"]
|
||||
end
|
||||
|
||||
json.issue do
|
||||
|
|
|
@ -59,4 +59,6 @@ if @project.forge?
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
json.readme @readme.merge(content: readme_render_decode64_content(@readme["content"], nil))
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue