新增:标签名字列表
This commit is contained in:
parent
fa48e3f5ca
commit
35965f542a
|
@ -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
|
|
@ -1,5 +1,5 @@
|
||||||
json.array! @tags do |tag|
|
json.array! @tags do |tag|
|
||||||
if tag.present?
|
if tag.present? && tag.is_a?(Hash)
|
||||||
json.name tag['name']
|
json.name tag['name']
|
||||||
json.id tag['id']
|
json.id tag['id']
|
||||||
json.zipball_url render_zip_url(@owner, @repository, tag['name'])
|
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']
|
json.partial! 'commit_author', user: render_cache_commit_author(tag['commit']['author']), name: tag['commit']['author']['name']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
json.name tag
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue