FIX get branches api bug and project menu list bug

This commit is contained in:
jasder 2021-03-28 19:56:11 +08:00
parent 56f01801ae
commit f282d971e3
1 changed files with 6 additions and 3 deletions

View File

@ -11,7 +11,7 @@ class ProjectsController < ApplicationController
menu = []
menu.append(menu_hash_by_name("home"))
menu.append(menu_hash_by_name("code"))
menu.append(menu_hash_by_name("code")) if @project.has_menu_permission("code")
menu.append(menu_hash_by_name("issues")) if @project.has_menu_permission("issues")
menu.append(menu_hash_by_name("pulls")) if @project.has_menu_permission("pulls")
menu.append(menu_hash_by_name("devops")) if @project.has_menu_permission("devops")
@ -66,7 +66,10 @@ class ProjectsController < ApplicationController
end
def branches
@branches = @project.forge? ? Gitea::Repository::Branches::ListService.new(@owner, @project.identifier).call : []
return @branches = [] unless @project.forge?
result = Gitea::Repository::Branches::ListService.call(@owner, @project.identifier)
@branches = result.is_a?(Hash) && result.key?(:status) ? [] : result
end
def group_type_list