diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-15 12:08:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-15 12:08:57 +0300 |
commit | 45a8c43afe8a17de19a92708b380b29b6ae04ce6 (patch) | |
tree | 4104e6ac741fbbdeefe9b8b699650a06c14e9056 /app/finders/template_finder.rb | |
parent | 6bc327a3491069240bd73cc83e17b3078c4148b0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders/template_finder.rb')
-rw-r--r-- | app/finders/template_finder.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/app/finders/template_finder.rb b/app/finders/template_finder.rb index b82b601541c..c6c5c30cbf7 100644 --- a/app/finders/template_finder.rb +++ b/app/finders/template_finder.rb @@ -16,16 +16,27 @@ class TemplateFinder def build(type, project, params = {}) if type.to_s == 'licenses' LicenseTemplateFinder.new(project, params) # rubocop: disable CodeReuse/Finder - else + elsif type_allowed?(type) new(type, project, params) end end def all_template_names(project, type) - return {} if !VENDORED_TEMPLATES.key?(type.to_s) && type.to_s != 'licenses' + return {} unless type_allowed?(type) build(type, project).template_names end + + def type_allowed?(type) + case type.to_s + when 'licenses' + true + when 'metrics_dashboard_ymls' + !Feature.enabled?(:remove_monitor_metrics) + else + VENDORED_TEMPLATES.key?(type) + end + end end attr_reader :type, :project, :params |