aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@gitea.io>2023-01-29 23:36:04 -0500
committerGitHub <noreply@github.com>2023-01-30 12:36:04 +0800
commit203681d084dc2b85a7e66170dab93d4e843066d0 (patch)
treecf78d41f8a22578ea7a3861c824830a1ea5ffc96
parentd0d257b243177d1ec9d9753adacd7dd9807408fa (diff)
downloadgitea-203681d084dc2b85a7e66170dab93d4e843066d0.tar.gz
gitea-203681d084dc2b85a7e66170dab93d4e843066d0.zip
Issues: support setting issue template field values with query (#22545)
-rw-r--r--routers/web/repo/issue.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/routers/web/repo/issue.go b/routers/web/repo/issue.go
index ed7461bbc6..5bff9e67f3 100644
--- a/routers/web/repo/issue.go
+++ b/routers/web/repo/issue.go
@@ -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
}