diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-18 18:08:04 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-18 18:08:04 +0000 |
commit | bbe243060399191abcba33c7ebd611f6ec34c6cd (patch) | |
tree | 769ba47355cb903bc9139232d75710232ccb545a /app/models/merge_request.rb | |
parent | ccf37fd3eca15cd5f55c1eba3b28d2798808d357 (diff) | |
download | gitlab-ce-bbe243060399191abcba33c7ebd611f6ec34c6cd.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/merge_request.rb')
-rw-r--r-- | app/models/merge_request.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index 2280c5280d5..cdb6205cd51 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -1122,22 +1122,18 @@ class MergeRequest < ApplicationRecord actual_head_pipeline.success? end - def environments_for(current_user) + def environments_for(current_user, latest: false) return [] unless diff_head_commit - @environments ||= Hash.new do |h, current_user| - envs = EnvironmentsFinder.new(target_project, current_user, - ref: target_branch, commit: diff_head_commit, with_tags: true).execute + envs = EnvironmentsFinder.new(target_project, current_user, + ref: target_branch, commit: diff_head_commit, with_tags: true, find_latest: latest).execute - if source_project - envs.concat EnvironmentsFinder.new(source_project, current_user, - ref: source_branch, commit: diff_head_commit).execute - end - - h[current_user] = envs.uniq + if source_project + envs.concat EnvironmentsFinder.new(source_project, current_user, + ref: source_branch, commit: diff_head_commit, find_latest: latest).execute end - @environments[current_user] + envs.uniq end ## |