1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-29 09:31:11 -05:00

Issues: support setting issue template field values with query (#22545)

This commit is contained in:
techknowlogick 2023-01-29 23:36:04 -05:00 committed by GitHub
parent d0d257b243
commit 203681d084
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -784,6 +784,14 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles
ctx.Data[ctxDataKey] = template.Content ctx.Data[ctxDataKey] = template.Content
if template.Type() == api.IssueTemplateTypeYaml { if template.Type() == api.IssueTemplateTypeYaml {
// Replace field default values by values from query
for _, field := range template.Fields {
fieldValue := ctx.FormString("field:" + field.ID)
if fieldValue != "" {
field.Attributes["value"] = fieldValue
}
}
ctx.Data["Fields"] = template.Fields ctx.Data["Fields"] = template.Fields
ctx.Data["TemplateFile"] = template.FileName ctx.Data["TemplateFile"] = template.FileName
} }