Merge branch 'develop' into standalone_develop
This commit is contained in:
commit
e1b4622ede
|
@ -88,7 +88,7 @@ class ProjectsController < ApplicationController
|
|||
return @branches = [] unless @project.forge?
|
||||
|
||||
# result = Gitea::Repository::Branches::ListService.call(@owner, @project.identifier)
|
||||
result = Gitea::Repository::Branches::ListNameService.call(@owner, @project.identifier)
|
||||
result = Gitea::Repository::Branches::ListNameService.call(@owner, @project.identifier, params[:name])
|
||||
@branches = result.is_a?(Hash) ? (result.key?(:status) ? [] : result["branch_name"]) : result
|
||||
end
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class PullRequestsController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@all_branches = Branches::ListService.call(@owner, @project)
|
||||
@all_branches = Branches::ListService.call(@owner, @project, params[:branch_name])
|
||||
@is_fork = @project.forked_from_project_id.present?
|
||||
@projects_names = [{
|
||||
project_user_login: @owner.try(:login),
|
||||
|
@ -50,7 +50,7 @@ class PullRequestsController < ApplicationController
|
|||
end
|
||||
|
||||
def get_branches
|
||||
branch_result = Branches::ListService.call(@owner, @project)
|
||||
branch_result = Branches::ListService.call(@owner, @project, params[:name])
|
||||
render json: branch_result
|
||||
# return json: branch_result
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ class VersionReleasesController < ApplicationController
|
|||
def new
|
||||
#获取所有的分支
|
||||
@all_branches = []
|
||||
get_all_branches = Gitea::Repository::Branches::ListService.new(@user, @repository.try(:identifier)).call
|
||||
get_all_branches = Gitea::Repository::Branches::ListService.new(@user, @repository.try(:identifier), params[:branch_name]).call
|
||||
if get_all_branches && get_all_branches.size > 0
|
||||
get_all_branches.each do |b|
|
||||
@all_branches.push(b["name"])
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
class Branches::ListService < ApplicationService
|
||||
|
||||
attr_reader :user, :project
|
||||
attr_reader :user, :project, :name
|
||||
|
||||
def initialize(user, project)
|
||||
def initialize(user, project, name=nil)
|
||||
@user = user
|
||||
@project = project
|
||||
@name = name
|
||||
end
|
||||
|
||||
def call
|
||||
all_branches = []
|
||||
user_name = user.try(:show_real_name)
|
||||
identifier = project.repository.try(:identifier)
|
||||
get_all_branches = Gitea::Repository::Branches::ListService.new(user, identifier).call
|
||||
get_all_branches = Gitea::Repository::Branches::ListService.new(user, identifier, name).call
|
||||
all_branches = branch_lists(user_name,user.try(:login), identifier, get_all_branches) if get_all_branches && get_all_branches.size > 0
|
||||
return all_branches
|
||||
end
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
class Gitea::Repository::Branches::ListNameService < Gitea::ClientService
|
||||
attr_reader :user, :repo
|
||||
attr_reader :user, :repo, :name
|
||||
|
||||
def initialize(user, repo)
|
||||
def initialize(user, repo, name=nil)
|
||||
@user = user
|
||||
@repo = repo
|
||||
@name = name
|
||||
end
|
||||
|
||||
def call
|
||||
|
@ -13,7 +14,7 @@ class Gitea::Repository::Branches::ListNameService < Gitea::ClientService
|
|||
|
||||
private
|
||||
def params
|
||||
Hash.new.merge(token: user.gitea_token)
|
||||
Hash.new.merge(token: user.gitea_token, name: name)
|
||||
end
|
||||
|
||||
def url
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
class Gitea::Repository::Branches::ListService < Gitea::ClientService
|
||||
attr_reader :user, :repo
|
||||
attr_reader :user, :repo, :name
|
||||
|
||||
def initialize(user, repo)
|
||||
def initialize(user, repo, name=nil)
|
||||
@user = user
|
||||
@repo = repo
|
||||
@name = name
|
||||
end
|
||||
|
||||
def call
|
||||
|
@ -13,7 +14,7 @@ class Gitea::Repository::Branches::ListService < Gitea::ClientService
|
|||
|
||||
private
|
||||
def params
|
||||
Hash.new.merge(token: user.gitea_token)
|
||||
Hash.new.merge(token: user.gitea_token, name: name)
|
||||
end
|
||||
|
||||
def url
|
||||
|
|
Loading…
Reference in New Issue