diff options
Diffstat (limited to 'app/finders/template_finder.rb')
-rw-r--r-- | app/finders/template_finder.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/app/finders/template_finder.rb b/app/finders/template_finder.rb index 36f8d144908..739beee236c 100644 --- a/app/finders/template_finder.rb +++ b/app/finders/template_finder.rb @@ -22,16 +22,26 @@ class TemplateFinder end end + # This is temporary and will be removed once we introduce group level inherited templates and + # remove the inherited_issuable_templates FF + def all_template_names_hash_or_array(project, issuable_type) + if project.inherited_issuable_templates_enabled? + all_template_names(project, issuable_type.pluralize) + else + all_template_names_array(project, issuable_type.pluralize) + end + end + def all_template_names(project, type) return {} if !VENDORED_TEMPLATES.key?(type.to_s) && type.to_s != 'licenses' build(type, project).template_names end - # This is issues and merge requests description templates only. - # This will be removed once we introduce group level inherited templates + # This is for issues and merge requests description templates only. + # This will be removed once we introduce group level inherited templates and remove the inherited_issuable_templates FF def all_template_names_array(project, type) - all_template_names(project, type).values.flatten.uniq + all_template_names(project, type).values.flatten.select { |tmpl| tmpl[:project_id] == project.id }.compact.uniq end end |