forked from forgejo/forgejo
Extend issue template yaml engine (#29274)
Add new option: `visible`: witch can hide a specific field of the form or the created content afterwards It is a string array witch can contain `form` and `content`. If only `form` is present, it wont show up in the created issue afterwards and the other way around. By default it sets both except for markdown As they are optional and github don't have any similar thing, it is non breaking and also do not conflict with it. With this you can: - define "post issue creation" elements like a TODO list to track an issue state - make sure to have a checkbox that reminds the user to check for a thing but dont have it in the created issue afterwards - define markdown for the created issue (was the downside of using yaml instead of md in the past) - ... ## Demo ```yaml name: New Contribution description: External Contributor creating a pull body: - type: checkboxes id: extern-todo visible: [form] attributes: label: Contribution Guidelines options: - label: I checked there exist no similar feature to be extended required: true - label: I did read the CONTRIBUTION.MD required: true - type: checkboxes id: intern-todo visible: [content] attributes: label: Maintainer Check-List options: - label: Does this pull follow the KISS principe - label: Checked if internal bord was notifyed # .... ``` [Demo Video](https://cloud.obermui.de/s/tm34fSAbJp9qw9z/download/vid-20240220-152751.mkv) --- *Sponsored by Kithara Software GmbH* --------- Co-authored-by: John Olheiser <john.olheiser@gmail.com> Co-authored-by: delvh <dev.lh@web.de> (cherry picked from commit 77e29e0c39392f142627303bd798fb55258072b2)
This commit is contained in:
parent
ba7983aedc
commit
ff8f7a7a0d
11 changed files with 247 additions and 50 deletions
|
@ -128,9 +128,18 @@ func unmarshal(filename string, content []byte) (*api.IssueTemplate, error) {
|
|||
}
|
||||
}
|
||||
for i, v := range it.Fields {
|
||||
// set default id value
|
||||
if v.ID == "" {
|
||||
v.ID = strconv.Itoa(i)
|
||||
}
|
||||
// set default visibility
|
||||
if v.Visible == nil {
|
||||
v.Visible = []api.IssueFormFieldVisible{api.IssueFormFieldVisibleForm}
|
||||
// markdown is not submitted by default
|
||||
if v.Type != api.IssueFormFieldTypeMarkdown {
|
||||
v.Visible = append(v.Visible, api.IssueFormFieldVisibleContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue