From fa17a2eb7fbb1f59bfe2ff40b93179ba06724bd3 Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Tue, 2 Jun 2020 16:06:51 +0800 Subject: [PATCH] change commits committer --- app/models/user.rb | 2 +- app/views/repositories/commits.json.jbuilder | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/models/user.rb b/app/models/user.rb index c62334906..f37e61923 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -96,7 +96,7 @@ class User < ApplicationRecord where("LOWER(concat(lastname, firstname, login, mail)) LIKE ?", "%#{keywords.split(" ").join('|')}%") unless keywords.blank? } - scope :simple_select, -> {select(:id, :login, :lastname,:firstname, :nickname)} + scope :simple_select, -> {select(:id, :login, :lastname,:firstname, :nickname, :gitea_uid)} attr_accessor :password, :password_confirmation diff --git a/app/views/repositories/commits.json.jbuilder b/app/views/repositories/commits.json.jbuilder index 371ade1f6..7cbf34c4d 100644 --- a/app/views/repositories/commits.json.jbuilder +++ b/app/views/repositories/commits.json.jbuilder @@ -5,11 +5,10 @@ else json.total_count @hash_commit[:total_count] json.commits do json.array! @hash_commit[:body] do |commit| - Rails.logger.info("#######______commit______#########{commit}") commiter = commit['committer'] if commiter.present? - commit_user = commiter['name'] - forge_user = User.simple_select.find_by(login: commit_user) + commit_user_id = commiter['id'] + forge_user = User.simple_select.find_by(gitea_uid: commit_user_id) end json.sha commit['sha'] json.message commit['commit']['message']