]> source.dussan.org Git - gitea.git/commitdiff
Issues: support setting issue template field values with query (#22545)
authortechknowlogick <techknowlogick@gitea.io>
Mon, 30 Jan 2023 04:36:04 +0000 (23:36 -0500)
committerGitHub <noreply@github.com>
Mon, 30 Jan 2023 04:36:04 +0000 (12:36 +0800)
routers/web/repo/issue.go

index ed7461bbc669ca17e4a7fbe1eb4dc060f57154f1..5bff9e67f340a3f8db7a6fdaca92d55594941c70 100644 (file)
@@ -784,6 +784,14 @@ func setTemplateIfExists(ctx *context.Context, ctxDataKey string, possibleFiles
                ctx.Data[ctxDataKey] = template.Content
 
                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["TemplateFile"] = template.FileName
                }