forked from Gitlink/forgeplus
Merge pull request '用户可以查看其他用户的构建列表' (#10) from trustie_server into develop
Reviewed-on: https://git.trustie.net/jasder/forgeplus/pulls/10
This commit is contained in:
commit
2f140d13f0
|
@ -50,14 +50,22 @@ class Ci::BaseController < ApplicationController
|
|||
end
|
||||
|
||||
def connect_to_ci_db(options={})
|
||||
if !(current_user && !current_user.is_a?(AnonymousUser) && !current_user.devops_uninit?)
|
||||
current = current_user
|
||||
owner = params[:owner]
|
||||
if owner
|
||||
current = User.find_by(login: owner)
|
||||
end
|
||||
|
||||
if !(current && !current.is_a?(AnonymousUser) && !current.devops_uninit?)
|
||||
return
|
||||
end
|
||||
if current_user.ci_cloud_account.server_type == Ci::CloudAccount::SERVER_TYPE_TRUSTIE
|
||||
|
||||
if current.ci_cloud_account.server_type == Ci::CloudAccount::SERVER_TYPE_TRUSTIE
|
||||
connect_to_trustie_ci_database(options)
|
||||
else
|
||||
connect_to_ci_database(options)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,7 +8,6 @@ class Ci::BuildsController < Ci::BaseController
|
|||
|
||||
def index
|
||||
@user = current_user
|
||||
scope = @repo.builds
|
||||
|
||||
scope = Ci::Builds::ListQuery.call(@repo, params)
|
||||
|
||||
|
|
|
@ -8,4 +8,8 @@ module Ci::BuildsHelper
|
|||
return nil if end_time == 0 || start_time == 0
|
||||
game_spend_time(end_time - start_time)
|
||||
end
|
||||
|
||||
def render_build_author login
|
||||
User.find_by(login: login)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@ json.action build.build_action
|
|||
json.error build.build_error if build.build_status == 'error'
|
||||
json.message build.build_message
|
||||
json.author do
|
||||
json.partial! 'author', user: current_user
|
||||
json.partial! 'author', user: render_build_author(build.build_author)
|
||||
end
|
||||
json.started format_utc_time build.build_started
|
||||
json.finished format_utc_time build.build_finished
|
||||
|
|
Loading…
Reference in New Issue