File templates fetching refactor [RUN AS-IF-FOSS] [RUN ALL RSPEC]
What does this MR do?
This MR tries to extract a part of the bigger !51692 (closed) MR related to common code around file template fetching.
Refactor the code around template fetching to make it reusable and ready to be adjusted for inheritable issue and merge requests templates.
The intent is of this MR is to also use TemplateFinder as SSOT for fetching templates. We have several types of file templates, but only issue and merge request description template names are cached. That has been added some time ago now, but I think it is done mostly because of the higher usage of issues and merge requests where caching helps limit the number of requests to gitaly. Because issue and merge requests use caching we were fetching those template names through repository model and other template names by calling the TemplateFinder.build().execute
.
With this change we can fetch all templates through TemplateFinder.template_names(project, type)
and it will take care to fetch the issue and merge request ones from cache.
Screenshots (strongly suggested)
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team