fix: not show commiter avatar

This commit is contained in:
vilet.yy 2021-03-30 16:34:12 +08:00
parent d7a459bad2
commit d0a65775aa
6 changed files with 19 additions and 6 deletions

View File

@ -28,7 +28,7 @@ module RepositoriesHelper
def render_commit_author(author_json)
return nil if author_json.blank?
find_user_by_login author_json['login']
find_user_by_login author_json['name']
end
def readme_render_decode64_content(str, path)

View File

@ -1,5 +1,6 @@
json.author do
if @project.forge?
json.id user.id
json.login user.login
json.type user&.type
json.name user.real_name

View File

@ -26,9 +26,9 @@ if @project.forge?
end
json.author do
json.partial! 'commit_author', user: render_commit_author(commit['author'])
json.partial! 'commit_author', user: render_commit_author(commit['commit']['author']), name: commit['commit']['author']['name']
end
json.committer do
json.partial! 'commit_author', user: render_commit_author(commit['committer'])
json.partial! 'commit_author', user: render_commit_author(commit['commit']['committer']), name: commit['commit']['committer']['name']
end
end

View File

@ -4,5 +4,8 @@ if user
json.name user.real_name
json.image_url url_to_avatar(user)
else
json.nil!
json.id nil
json.login name
json.name name
json.image_url File.join("avatars/User","b")
end

View File

@ -5,6 +5,7 @@ else
json.total_count @hash_commit[:total_count]
json.commits do
json.array! @hash_commit[:body] do |commit|
json.commit1 commit
commiter = commit['committer']
if commiter.present?
commit_user_id = commiter['id']
@ -17,7 +18,13 @@ else
if forge_user
json.partial! 'author', user: forge_user
else
json.author nil
json.author do
json.id nil
json.login commit['commit']['author']['name']
json.type nil
json.name commit['commit']['author']['name']
json.image_url File.join("avatars/User","b")
end
end
end
end

View File

@ -61,7 +61,7 @@ json.release_versions do
json.tag_name release["tag_name"]
json.created_at format_time(release["created_at"].to_time)
end
json.total_count @result[:release].size
json.total_count @repository&.version_releases.size
end
json.branches do
json.list @result[:branch].each do |branch|
@ -93,3 +93,5 @@ json.contributors do
json.total_count total_count
end
json.languages @result[:language]
json.partial! 'author', locals: { user: @project.owner }