diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2019-08-23 23:50:01 +0300 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2019-08-23 23:50:01 +0300 |
commit | 459309fa57e86599c53d0d3f867053ceb24d432b (patch) | |
tree | 590bcf8118441e8eb39aa13e9bb178809a0ed9ae /app | |
parent | 3203367e4ab0fdc1281dd265d0452178e87ac405 (diff) | |
parent | d86b77bf20474702631d5fd89177c54a9f928760 (diff) |
Merge branch '66037-deployment-user' into 'master'
Return correct user for manual deployments
See merge request gitlab-org/gitlab-ce!32004
Diffstat (limited to 'app')
-rw-r--r-- | app/models/deployment.rb | 8 | ||||
-rw-r--r-- | app/serializers/deployment_entity.rb | 2 | ||||
-rw-r--r-- | app/views/projects/deployments/_deployment.html.haml | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb index 68586e7a1fd..bff5d348ca0 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -162,6 +162,14 @@ class Deployment < ApplicationRecord deployed_at&.to_time&.in_time_zone&.to_s(:medium) end + def deployed_by + # We use deployable's user if available because Ci::PlayBuildService + # does not update the deployment's user, just the one for the deployable. + # TODO: use deployment's user once https://gitlab.com/gitlab-org/gitlab-ce/issues/66442 + # is completed. + deployable&.user || user + end + private def ref_path diff --git a/app/serializers/deployment_entity.rb b/app/serializers/deployment_entity.rb index d6466ad1cdd..8b967459173 100644 --- a/app/serializers/deployment_entity.rb +++ b/app/serializers/deployment_entity.rb @@ -21,7 +21,7 @@ class DeploymentEntity < Grape::Entity expose :deployed_at expose :tag expose :last? - expose :user, using: UserEntity + expose :deployed_by, as: :user, using: UserEntity expose :deployable do |deployment, opts| deployment.deployable.yield_self do |deployable| diff --git a/app/views/projects/deployments/_deployment.html.haml b/app/views/projects/deployments/_deployment.html.haml index a11e23b6daa..752be02443c 100644 --- a/app/views/projects/deployments/_deployment.html.haml +++ b/app/views/projects/deployments/_deployment.html.haml @@ -15,10 +15,10 @@ .flex-truncate-child = link_to [@project.namespace.becomes(Namespace), @project, deployment.deployable], class: 'build-link' do #{deployment.deployable.name} (##{deployment.deployable.id}) - - if deployment.user + - if deployment.deployed_by %div by - = user_avatar(user: deployment.user, size: 20, css_class: "mr-0 float-none") + = user_avatar(user: deployment.deployed_by, size: 20, css_class: "mr-0 float-none") .table-section.section-15{ role: 'gridcell' } .table-mobile-header{ role: 'rowheader' }= _("Created") |