Browse Source

fix: remove detail language and contributors

tags/v4.0.0^2
yystopf 4 years ago
parent
commit
c4586fbb36
2 changed files with 2 additions and 20 deletions
  1. +1
    -19
      app/services/repositories/detail_service.rb
  2. +1
    -1
      app/views/repositories/contributors.json.jbuilder

+ 1
- 19
app/services/repositories/detail_service.rb View File

@@ -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
- 1
app/views/repositories/contributors.json.jbuilder View File

@@ -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…
Cancel
Save