fix: detail release version limit

This commit is contained in:
vilet.yy 2021-03-30 16:34:31 +08:00
parent d0a65775aa
commit ffa2782637
2 changed files with 5 additions and 4 deletions

View File

@ -1,12 +1,13 @@
# Get a list of all commits from a repository
class Gitea::Versions::ListService < Gitea::ClientService
attr_reader :token, :user_name, :repo
attr_reader :token, :user_name, :repo, :args
# sha: SHA or branch to start listing commits from (usually 'master')
def initialize(token, user_name, repo)
def initialize(token, user_name, repo, args={})
@token = token
@user_name = user_name
@repo = repo
@args = args
end
def call
@ -16,7 +17,7 @@ class Gitea::Versions::ListService < Gitea::ClientService
private
def params
Hash.new.merge(token: token)
args.merge(token: token)
end
def url

View File

@ -37,7 +37,7 @@ class Repositories::DetailService < ApplicationService
end
def release_suitable
releases = Gitea::Versions::ListService.call(@owner.gitea_token, @owner.try(:login), @repo.try(:identifier))
releases = Gitea::Versions::ListService.call(@owner.gitea_token, @owner.try(:login), @repo.try(:identifier), {page: 1, limit: 1})
releases.is_a?(Hash) && releases[:status] == -1 ? [] : releases
end