Browse Source

fix: not show commiter avatar

tags/v3.0.2
vilet.yy 5 years ago
parent
commit
d0a65775aa
6 changed files with 19 additions and 6 deletions
  1. +1
    -1
      app/helpers/repositories_helper.rb
  2. +1
    -0
      app/views/repositories/_author.json.jbuilder
  3. +2
    -2
      app/views/repositories/_commit.json.jbuilder
  4. +4
    -1
      app/views/repositories/_commit_author.json.jbuilder
  5. +8
    -1
      app/views/repositories/commits.json.jbuilder
  6. +3
    -1
      app/views/repositories/detail.json.jbuilder

+ 1
- 1
app/helpers/repositories_helper.rb 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)


+ 1
- 0
app/views/repositories/_author.json.jbuilder 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


+ 2
- 2
app/views/repositories/_commit.json.jbuilder 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

+ 4
- 1
app/views/repositories/_commit_author.json.jbuilder 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

+ 8
- 1
app/views/repositories/commits.json.jbuilder 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


+ 3
- 1
app/views/repositories/detail.json.jbuilder 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 }

Loading…
Cancel
Save