diff --git a/app/controllers/ci/base_controller.rb b/app/controllers/ci/base_controller.rb index 47788ed77..c17105cd6 100644 --- a/app/controllers/ci/base_controller.rb +++ b/app/controllers/ci/base_controller.rb @@ -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 diff --git a/app/controllers/ci/builds_controller.rb b/app/controllers/ci/builds_controller.rb index 4900a890a..e6caf8936 100644 --- a/app/controllers/ci/builds_controller.rb +++ b/app/controllers/ci/builds_controller.rb @@ -8,7 +8,6 @@ class Ci::BuildsController < Ci::BaseController def index @user = current_user - scope = @repo.builds scope = Ci::Builds::ListQuery.call(@repo, params) diff --git a/app/helpers/ci/builds_helper.rb b/app/helpers/ci/builds_helper.rb index c0e591069..0e352ced2 100644 --- a/app/helpers/ci/builds_helper.rb +++ b/app/helpers/ci/builds_helper.rb @@ -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 diff --git a/app/views/ci/builds/_build.json.jbuilder b/app/views/ci/builds/_build.json.jbuilder index 1c1afcbf1..669be1f12 100644 --- a/app/views/ci/builds/_build.json.jbuilder +++ b/app/views/ci/builds/_build.json.jbuilder @@ -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