修改commit返回的用户
This commit is contained in:
parent
d1089a4a4b
commit
f54c374c78
|
@ -44,7 +44,6 @@ class RepositoriesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def commits
|
def commits
|
||||||
@project_owner = @project.owner
|
|
||||||
@hash_commit = Gitea::Repository::Commits::ListService.new(@project_owner.login, @project.identifier,
|
@hash_commit = Gitea::Repository::Commits::ListService.new(@project_owner.login, @project.identifier,
|
||||||
sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call
|
sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call
|
||||||
end
|
end
|
||||||
|
|
|
@ -96,6 +96,8 @@ class User < ApplicationRecord
|
||||||
where("LOWER(concat(lastname, firstname, login, mail)) LIKE ?", "%#{keywords.split(" ").join('|')}%") unless keywords.blank?
|
where("LOWER(concat(lastname, firstname, login, mail)) LIKE ?", "%#{keywords.split(" ").join('|')}%") unless keywords.blank?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
scope :simple_select, -> {select(:id, :login, :lastname,:firstname, :nickname)}
|
||||||
|
|
||||||
attr_accessor :password, :password_confirmation
|
attr_accessor :password, :password_confirmation
|
||||||
|
|
||||||
delegate :gender, :department_id, :school_id, :location, :location_city, :technical_title, to: :user_extension, allow_nil: true
|
delegate :gender, :department_id, :school_id, :location, :location_city, :technical_title, to: :user_extension, allow_nil: true
|
||||||
|
|
|
@ -5,11 +5,19 @@ else
|
||||||
json.total_count @hash_commit[:total_count]
|
json.total_count @hash_commit[:total_count]
|
||||||
json.commits do
|
json.commits do
|
||||||
json.array! @hash_commit[:body] do |commit|
|
json.array! @hash_commit[:body] do |commit|
|
||||||
|
commit_user = commit['committer']['name']
|
||||||
|
if commit_user
|
||||||
|
forge_user = User.simple_select.find_by(login: commit_user)
|
||||||
|
end
|
||||||
json.sha commit['sha']
|
json.sha commit['sha']
|
||||||
json.message commit['commit']['message']
|
json.message commit['commit']['message']
|
||||||
json.timestamp render_unix_time(commit['commit']['author']['date'])
|
json.timestamp render_unix_time(commit['commit']['author']['date'])
|
||||||
json.time_from_now time_from_now(commit['commit']['author']['date'])
|
json.time_from_now time_from_now(commit['commit']['author']['date'])
|
||||||
json.partial! 'author', user: @project_owner
|
if forge_user
|
||||||
|
json.partial! 'author', user: forge_user
|
||||||
|
else
|
||||||
|
json.author nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue