forked from Trustie/forgeplus
FIX repositories detail api bug
This commit is contained in:
parent
e1d7b0b881
commit
ad4617288d
|
@ -210,7 +210,7 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_ref
|
def get_ref
|
||||||
@ref = params[:ref] || @project.default_branch
|
@ref = params[:ref] || @project&.default_branch
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_latest_commit
|
def get_latest_commit
|
||||||
|
|
|
@ -41,11 +41,13 @@ class Repositories::DetailService < ApplicationService
|
||||||
end
|
end
|
||||||
|
|
||||||
def branch_suitable
|
def branch_suitable
|
||||||
Gitea::Repository::Branches::ListService.call(@owner, @repo.identifier)
|
branches = Gitea::Repository::Branches::ListService.call(@owner, @repo.identifier)
|
||||||
|
branches.is_a?(Hash) && branches[:status] == :error ? [] : branches
|
||||||
end
|
end
|
||||||
|
|
||||||
def tag_suitable
|
def tag_suitable
|
||||||
Gitea::Repository::Tags::ListService.call(@owner&.gitea_token, @owner.login, @repo.identifier)
|
tags = Gitea::Repository::Tags::ListService.call(@owner&.gitea_token, @owner.login, @repo.identifier)
|
||||||
|
tags.is_a?(Hash) && tags[:status] == -1 ? [] : tags
|
||||||
end
|
end
|
||||||
|
|
||||||
def contributor_suitable
|
def contributor_suitable
|
||||||
|
|
Loading…
Reference in New Issue