Loading
Use project settings template for new work items
What does this MR do and why?
When creating work items outside the standard create flow (issue board,
epic child item, WorkItemCreate GraphQL mutation),
assign_description_from_template only checked the repository
Default.md, ignoring project.issues_template (project settings
template) which should take priority per the
documented priority order.
The fix overrides assign_description_from_template in EE: when
issues_template is set and licensed, the method is a no-op, leaving
params[:description] unset. This lets
BuildService#issue_params_from_template — which already handles this
correctly via its else branch — apply the project settings template
without concatenating a repo template.
How to set up and validate locally
Requires a license with the issuable_default_templates feature
(Premium/Ultimate).
- Create a project and add a repo template at
.gitlab/issue_templates/Default.md, e.g.Repo template content. - In the project's Settings > General > Issues, set the "Default
description template for issues" (
issues_template) to something distinct, e.g.Project settings template. - Create a work item through one of the non-standard flows, since the
bug doesn't reproduce through the normal "New issue" form:
- From an issue board, click + to create an issue in a list.
- From an epic, add a new child issue/task.
- Or call the
WorkItemCreateGraphQL mutation directly for the project, without passing adescription.
- Before this fix: the created item's description is the repo
Default.mdcontent (or the repo template concatenated with the project template). - After this fix: the created item's description is exactly the
project settings template (
Project settings template), matching the documented priority order. - Confirm the existing/added specs pass:
bundle exec rspec ee/spec/services/ee/issues/create_service_spec.rb
References
Edited by Aryann Dwivedi