diff --git a/app/views/api/v1/projects/code_stats/index.json.jbuilder b/app/views/api/v1/projects/code_stats/index.json.jbuilder index d438e2624..0b64270f7 100644 --- a/app/views/api/v1/projects/code_stats/index.json.jbuilder +++ b/app/views/api/v1/projects/code_stats/index.json.jbuilder @@ -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"] diff --git a/app/views/api/v1/users/_commit_user_email.json.jbuilder b/app/views/api/v1/users/_commit_user_email.json.jbuilder new file mode 100644 index 000000000..c4963628a --- /dev/null +++ b/app/views/api/v1/users/_commit_user_email.json.jbuilder @@ -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