Skip to content

Commit

Permalink
Issues: support setting issue template field values with query
Browse files Browse the repository at this point in the history
In Blender this is used to report a bug from inside the application, with
some fields automatically filled in.
  • Loading branch information
brechtvl committed Jan 27, 2023
1 parent 5ff037e commit c7a1a95
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions routers/web/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,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
}
Expand Down

0 comments on commit c7a1a95

Please sign in to comment.