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

This commit is contained in:
yystopf 2023-03-24 23:44:24 +08:00
parent c7f21fed4f
commit 3bfc6e1c2a
2 changed files with 8 additions and 14 deletions

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 = []

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