fix: remove detail language and contributors
This commit is contained in:
parent
f94006abfd
commit
c4586fbb36
|
@ -10,20 +10,12 @@ class Repositories::DetailService < ApplicationService
|
|||
def call
|
||||
return {
|
||||
repo: repo_suitable,
|
||||
contributor: contributor_suitable,
|
||||
language: language_suitable,
|
||||
branch_tag_total_count: branch_tag_total_count
|
||||
}
|
||||
rescue
|
||||
return {
|
||||
repo: {},
|
||||
release: [],
|
||||
branch: [],
|
||||
branch_type: [],
|
||||
tag: [],
|
||||
contributor: [],
|
||||
language: {},
|
||||
readme: {}
|
||||
branch_tag_total_count: {}
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -35,14 +27,4 @@ class Repositories::DetailService < ApplicationService
|
|||
def repo_suitable
|
||||
Gitea::Repository::GetService.call(@owner, @repo.identifier)
|
||||
end
|
||||
|
||||
def contributor_suitable
|
||||
contributors = Gitea::Repository::Contributors::GetService.call(@owner, @repo.identifier)
|
||||
contributors.is_a?(Hash) && contributors.key?(:status) ? [] : contributors
|
||||
end
|
||||
|
||||
def language_suitable
|
||||
result = Gitea::Repository::Languages::ListService.call(@owner.login, @repo.identifier, @user&.gitea_token)
|
||||
result[:status] === :success ? hash_transform_precentagable(result[:body]) : nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
total_count = @contributors.size
|
||||
json.contributors @contributors.each do |contributor|
|
||||
json.list @contributors.each do |contributor|
|
||||
json.partial! 'contributor', locals: { contributor: contributor }
|
||||
end
|
||||
json.total_count total_count
|
||||
|
|
Loading…
Reference in New Issue