Skip to content

Support default templates for issues/MRs via .gitlab/ folders

What does this MR do and why?

Reusing the same logic that ?issuable_template= has, this MR selects a template named "Default" (case-insensitively) on the new issue and new merge request pages, if such a template exists, and if the ?issuable_template= parameter was not provided.

As mentioned in #2557 (comment 575825925):

However this might still be an acceptable performance to initially fetch the default template content directly from default.md without saving it to the DB

Could it really be this simple (a two line change) or have I missed something obvious? 🤔

Screenshots

Projects Settings page:

Screen_Shot_2021-12-17_at_10.34.32

Screen_Shot_2021-12-17_at_10.34.53

How to set up and validate locally

  1. Visit the new issue page on a repository, see that no default template was selected

  2. Create a .gitlab/issue_templates/default.md file in that repository

  3. Visit the new issue page on that repository, see that the default.md template was selected

  4. Create a new merge request on a repository, see that no default template was selected

  5. Create a .gitlab/merge_request_templates/default.md file in that repository

  6. Create a new merge request on that repository, see that the default.md template was selected

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #2557 (closed) Related to #15846

Edited by Marcin Sedlak-Jakubowski

Merge request reports