Browse Source

fixed 代码贡献者email

pull/313/head
xxq250 3 years ago
parent
commit
7c80f74e26
2 changed files with 23 additions and 1 deletions
  1. +1
    -1
      app/views/api/v1/projects/code_stats/index.json.jbuilder
  2. +22
    -0
      app/views/api/v1/users/_commit_user_email.json.jbuilder

+ 1
- 1
app/views/api/v1/projects/code_stats/index.json.jbuilder View File

@@ -6,7 +6,7 @@ json.deletions @result_object["deletions"]
json.commit_count_in_all_branches @result_object["commit_count_in_all_branches"]
json.authors @result_object["authors"].each do |author|
json.author do
json.partial! 'api/v1/users/commit_user', locals: { user: render_cache_commit_author(author), name: author['name'] }
json.partial! 'api/v1/users/commit_user_email', locals: { user: render_cache_commit_author(author), name: author['name'], email: author['email'] }
end
json.commits author["commits"]
json.additions author["additions"]


+ 22
- 0
app/views/api/v1/users/_commit_user_email.json.jbuilder View File

@@ -0,0 +1,22 @@
if user.present?
if user.is_a?(Hash)
json.id user["id"]
json.login user["login"]
json.name user["name"]
json.type user["type"]
json.image_url user["avatar_url"]
else
json.id user.id
json.login user.login
json.name user.real_name
json.type user&.type
json.image_url url_to_avatar(user)
end
else
json.id nil
json.login name
json.name name
json.email email
json.type nil
json.image_url User::Avatar.get_letter_avatar_url(name)
end

Loading…
Cancel
Save