mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
新增:标签名字列表
This commit is contained in:
23
app/services/gitea/repository/tags/list_name_service.rb
Normal file
23
app/services/gitea/repository/tags/list_name_service.rb
Normal 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
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user