From 3b15dd84fc7fc96d22b31c9caec00f9ccb07fb2d Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 18 Oct 2022 14:52:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=A0=87=E7=AD=BE?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E8=BF=94=E5=9B=9E=E6=80=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 4 ++++ app/views/repositories/tags.json.jbuilder | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 9f43d1ace..e32b31017 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -152,6 +152,10 @@ class RepositoriesController < ApplicationController @tags = result.is_a?(Hash) && result.key?(:status) ? [] : result else + name_result = Gitea::Repository::Tags::ListNameService.call(@owner, @project.identifier, params[:name]) + + @tag_names = result.is_a?(Hash) && result.key?(:status) ? [] : name_result + result = Gitea::Repository::Tags::ListService.call(current_user&.gitea_token, @owner.login, @project.identifier, {page: params[:page], limit: params[:limit]}) @tags = result.is_a?(Hash) && result.key?(:status) ? [] : result diff --git a/app/views/repositories/tags.json.jbuilder b/app/views/repositories/tags.json.jbuilder index b6fa1c491..4f5bb4330 100644 --- a/app/views/repositories/tags.json.jbuilder +++ b/app/views/repositories/tags.json.jbuilder @@ -1,4 +1,5 @@ -json.array! @tags do |tag| +json.total_count @tag_names.present? ? @tag_names.count : @tags.count +json.tags @tags do |tag| if tag.present? && tag.is_a?(Hash) json.name tag['name'] json.id tag['id']