add: commit show committer

This commit is contained in:
yystopf 2021-09-29 09:18:07 +08:00
parent 1d0255440a
commit cae59383b4
2 changed files with 22 additions and 14 deletions

View File

@ -2,10 +2,12 @@ if user
json.id user.id
json.login user.login
json.name user.real_name
json.type user&.type
json.image_url url_to_avatar(user)
else
json.id nil
json.login name
json.name name
json.type nil
json.image_url User::Avatar.get_letter_avatar_url(name)
end

View File

@ -7,25 +7,31 @@ else
json.array! @hash_commit[:body] do |commit|
commiter = commit['committer']
forge_user =
if commiter.present?
User.simple_select.find_by(gitea_uid: commiter['id'])
end
# forge_user =
# if commiter.present?
# User.simple_select.find_by(gitea_uid: commiter['id'])
# end
json.sha commit['sha']
json.message commit['commit']['message']
json.timestamp render_unix_time(commit['commit']['author']['date'])
json.time_from_now time_from_now(commit['commit']['author']['date'])
if forge_user
json.partial! 'author', user: forge_user
else
json.author do
json.id nil
json.login commit['commit']['author']['name']
json.type nil
json.name commit['commit']['author']['name']
json.image_url User::Avatar.get_letter_avatar_url(commit['commit']['author']['name'])
end
# if forge_user
# json.partial! 'author', user: forge_user
# else
# json.author do
# json.id nil
# json.login commit['commit']['author']['name']
# json.type nil
# json.name commit['commit']['author']['name']
# json.image_url User::Avatar.get_letter_avatar_url(commit['commit']['author']['name'])
# end
# end
json.author do
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['commit']['committer']), name: commit['commit']['committer']['name']
end
end
end