diff options
Diffstat (limited to 'app/models/environment_status.rb')
-rw-r--r-- | app/models/environment_status.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/environment_status.rb b/app/models/environment_status.rb index d06d0a99948..7687bc2be60 100644 --- a/app/models/environment_status.rb +++ b/app/models/environment_status.rb @@ -9,6 +9,7 @@ class EnvironmentStatus delegate :name, to: :environment delegate :status, to: :deployment, allow_nil: true delegate :deployed_at, to: :deployment, allow_nil: true + delegate :deployable, to: :deployment, allow_nil: true def self.for_merge_request(mr, user) build_environments_status(mr, user, mr.actual_head_pipeline) @@ -100,11 +101,14 @@ class EnvironmentStatus def self.build_environments_status(mr, user, pipeline) return [] unless pipeline - pipeline.environments_in_self_and_project_descendants.includes(:project).available.map do |environment| + environments = pipeline.environments_in_self_and_project_descendants.includes(:project) + environments = environments.available if Feature.disabled?(:review_apps_redeploy_mr_widget, mr.project) + environments.map do |environment| next unless Ability.allowed?(user, :read_environment, environment) EnvironmentStatus.new(pipeline.project, environment, mr, pipeline.sha) end.compact end + private_class_method :build_environments_status end |