diff options
author | Krasimir Angelov <kangelov@gitlab.com> | 2019-08-20 13:29:16 +0300 |
---|---|---|
committer | Krasimir Angelov <kangelov@gitlab.com> | 2019-08-22 15:36:55 +0300 |
commit | d86b77bf20474702631d5fd89177c54a9f928760 (patch) | |
tree | 3a1fcdc0eda151cb1e9b9a391e6a68df43060c02 /app/models/deployment.rb | |
parent | 51c19691e4c4ceb60ef28fd08c6b13549a423a39 (diff) |
Extract logic who created deployment into Deployment#deployed_by
Prefer the deployable user over the deployment user.
Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/66037.
Diffstat (limited to 'app/models/deployment.rb')
-rw-r--r-- | app/models/deployment.rb | 8 |
1 files changed, 8 insertions, 0 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 |