forked from Gitlink/forgeplus
fix: contributor load cache data
This commit is contained in:
parent
282d3d0122
commit
43c683e83f
|
@ -0,0 +1,16 @@
|
|||
user = $redis_cache.hgetall("v2-owner-common:#{contributor["login"]}-#{contributor["email"]}")
|
||||
if user.blank?
|
||||
json.contributions contributor["contributions"]
|
||||
# json.gid contributor["id"]
|
||||
json.login contributor["login"]
|
||||
json.type nil
|
||||
json.name contributor["login"]
|
||||
json.image_url User::Avatar.get_letter_avatar_url(contributor["login"])
|
||||
else
|
||||
json.contributions contributor["contributions"]
|
||||
# json.gid contributor["id"]
|
||||
json.login user["login"]
|
||||
json.type user["type"]
|
||||
json.name user["name"]
|
||||
json.image_url user["avatar_url"]
|
||||
end
|
|
@ -1,16 +1,6 @@
|
|||
total_count = @contributors.size
|
||||
json.contributors @contributors.each do |contributor|
|
||||
user = User.find_by(gitea_uid: contributor["id"])
|
||||
if contributor["login"] == "root"
|
||||
total_count -= 1
|
||||
next
|
||||
end
|
||||
json.contributions contributor["contributions"]
|
||||
# json.gid contributor["id"]
|
||||
json.login user.login
|
||||
json.type user&.type
|
||||
json.name user.real_name
|
||||
json.image_url url_to_avatar(user)
|
||||
json.partial! 'contributor', locals: { contributor: contributor }
|
||||
end
|
||||
json.total_count total_count
|
||||
|
||||
|
|
|
@ -56,17 +56,7 @@ json.tags_count @result[:branch_tag_total_count]['tag_count'] || 0
|
|||
json.contributors do
|
||||
total_count = @result[:contributor].size
|
||||
json.list @result[:contributor].each do |contributor|
|
||||
user = User.find_by(gitea_uid: contributor["id"])
|
||||
if contributor["login"] == "root" || user.nil?
|
||||
total_count -= 1
|
||||
next
|
||||
end
|
||||
json.contributions contributor["contributions"]
|
||||
json.gid contributor["id"]
|
||||
json.login user.login
|
||||
json.type user&.type
|
||||
json.name user.real_name
|
||||
json.image_url url_to_avatar(user)
|
||||
json.partial! 'contributor', locals: { contributor: contributor }
|
||||
end
|
||||
json.total_count total_count
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue