新增:标签名字列表

This commit is contained in:
yystopf 2022-10-18 13:31:12 +08:00
parent fa48e3f5ca
commit 35965f542a
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,23 @@
class Gitea::Repository::Tags::ListNameService < Gitea::ClientService
attr_reader :user, :repo, :name
def initialize(user, repo, name=nil)
@user = user
@repo = repo
@name = name
end
def call
response = get(url, params)
render_200_response(response)
end
private
def params
Hash.new.merge(token: user.gitea_token, name: name)
end
def url
"/repos/#{user.login}/#{repo}/tag_name_set".freeze
end
end

View File

@ -1,5 +1,5 @@
json.array! @tags do |tag|
if tag.present?
if tag.present? && tag.is_a?(Hash)
json.name tag['name']
json.id tag['id']
json.zipball_url render_zip_url(@owner, @repository, tag['name'])
@ -22,6 +22,8 @@ json.array! @tags do |tag|
json.partial! 'commit_author', user: render_cache_commit_author(tag['commit']['author']), name: tag['commit']['author']['name']
end
end
else
json.name tag
end
end