Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/finders/template_finder.rb')
-rw-r--r--app/finders/template_finder.rb15
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