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
|
def call
|
||||||
return {
|
return {
|
||||||
repo: repo_suitable,
|
repo: repo_suitable,
|
||||||
contributor: contributor_suitable,
|
|
||||||
language: language_suitable,
|
|
||||||
branch_tag_total_count: branch_tag_total_count
|
branch_tag_total_count: branch_tag_total_count
|
||||||
}
|
}
|
||||||
rescue
|
rescue
|
||||||
return {
|
return {
|
||||||
repo: {},
|
repo: {},
|
||||||
release: [],
|
branch_tag_total_count: {}
|
||||||
branch: [],
|
|
||||||
branch_type: [],
|
|
||||||
tag: [],
|
|
||||||
contributor: [],
|
|
||||||
language: {},
|
|
||||||
readme: {}
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -35,14 +27,4 @@ class Repositories::DetailService < ApplicationService
|
||||||
def repo_suitable
|
def repo_suitable
|
||||||
Gitea::Repository::GetService.call(@owner, @repo.identifier)
|
Gitea::Repository::GetService.call(@owner, @repo.identifier)
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
total_count = @contributors.size
|
total_count = @contributors.size
|
||||||
json.contributors @contributors.each do |contributor|
|
json.list @contributors.each do |contributor|
|
||||||
json.partial! 'contributor', locals: { contributor: contributor }
|
json.partial! 'contributor', locals: { contributor: contributor }
|
||||||
end
|
end
|
||||||
json.total_count total_count
|
json.total_count total_count
|
||||||
|
|
Loading…
Reference in New Issue