Support default templates for issues/MRs via .gitlab/ folders
What does this MR do and why?
This MR reintroduces !76326 (merged) that was reverted due to an issue (#350358 (closed)) with it applying when editing an issuable in addition to new ones. Now, the default template will only be selected if there is the issuable description is empty.
Additionally, the previous MR prioritised .gitlab
default templates above project settings, whereas this MR does not.
Screenshots or screen recordings
How to set up and validate locally
-
Visit the new issue page on a repository, see that no default template was selected
-
Create a .gitlab/issue_templates/default.md file in that repository
-
Visit the new issue page on that repository, see that the default.md template was selected
-
Create a new merge request on a repository, see that no default template was selected
-
Create a .gitlab/merge_request_templates/default.md file in that repository
-
Create a new merge request on that repository, see that the default.md template was selected
-
Now that repository-based default templates have been set, in the project Settings | General, set a "Default description template for issues"
-
Create a new issue, confirm that content from "Default description template for issues" is preferred over the .gitlab file
-
in the project Settings | General | Merge requests, set a "Default description template for merge requests"
-
Create a new merge request, confirm the content from "Default description template for merge requests" is preferred over the .gitlab file
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #2557 (closed)