mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-18 20:23:28 +02:00
transition: map field name to id
this commit allows a user to use the more friendly field.Name when transitioning to states which require custom field inputs. Signed-off-by: ldelossa <ldelossa@redhat.com>
This commit is contained in:
committed by
Louis DeLosSantos
parent
6a27e28c61
commit
3c1c4d95e1
@@ -165,6 +165,26 @@ func CmdTransition(o *oreo.Client, globals *jiracli.GlobalOptions, opts *Transit
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// if issueUpdate contains fields lets see if we can map them
|
||||
// to their ids
|
||||
if len(issueUpdate.Fields) > 0 {
|
||||
fields, err := jira.GetFields(o, globals.Endpoint.Value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for k, v := range issueUpdate.Fields {
|
||||
for _, f := range fields {
|
||||
if f.Name == k {
|
||||
// re-map to field.id
|
||||
issueUpdate.Fields[f.ID] = v
|
||||
delete(issueUpdate.Fields, k)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return jira.TransitionIssue(o, globals.Endpoint.Value, opts.Issue, &issueUpdate)
|
||||
})
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user