diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 15:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-18 15:09:34 +0300 |
commit | 213bd7e9d3d071e88f342511bdc48905b9d7e39c (patch) | |
tree | 5319e200d5f7916bb24502427af336d6d75bd5a6 /app/finders/template_finder.rb | |
parent | 00c8da9174df559fa0153fdf410b76830d8f85a3 (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 | 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 |