|
|
|
@@ -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 |
|
|
|
|