Browse Source

更改:贡献者移除获取cache数据

pull/330/head
yystopf 3 years ago
parent
commit
3bfc6e1c2a
2 changed files with 8 additions and 14 deletions
  1. +6
    -12
      app/controllers/repositories_controller.rb
  2. +2
    -2
      app/views/repositories/_contributor.json.jbuilder

+ 6
- 12
app/controllers/repositories_controller.rb View File

@@ -169,18 +169,12 @@ class RepositoriesController < ApplicationController
end
def contributors
@cache_result = $redis_cache.get("ProjectSpecialCommit:#{@project.id}")
if @cache_result.present?
@total_count = Project.mindspore_contributors.size
@contributors = kaminari_array_paginate(Project.mindspore_contributors)
else
if params[:filepath].present? || @project.educoder?
@contributors = []
else
result = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier, {page: params[:page], limit: params[:limit]})
@total_count = result[:total_count]
@contributors = result.is_a?(Hash) ? result[:body] : []
end
if params[:filepath].present? || @project.educoder?
@contributors = []
else
result = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier, {page: params[:page], limit: params[:limit]})
@total_count = result[:total_count]
@contributors = result.is_a?(Hash) ? result[:body] : []
end
rescue
@contributors = []


+ 2
- 2
app/views/repositories/_contributor.json.jbuilder View File

@@ -2,9 +2,9 @@ user = $redis_cache.hgetall("v2-owner-common:#{contributor["login"]}-#{contribut
if user.blank?
json.contributions contributor["contributions"]
# json.gid contributor["id"]
json.login contributor["login"]
json.login contributor["login"].downcase
json.type nil
json.name contributor["login"]
json.name contributor["login"].downcase
json.image_url User::Avatar.get_letter_avatar_url(contributor["login"])
json.contribution_perc User.new(login: contributor["login"], mail: contributor["email"]).simple_contribution_perc(project)
else


Loading…
Cancel
Save