From e63494bbe5c713603d794d0a5da0d7e0b47af7ed Mon Sep 17 00:00:00 2001 From: Adam Kunicki Date: Mon, 26 Jul 2021 14:27:53 -0700 Subject: [PATCH] Support older versions of Jira server that predate the switch to account IDs --- cmd/brew.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/brew.go b/cmd/brew.go index 81a8d8f..c2710bc 100644 --- a/cmd/brew.go +++ b/cmd/brew.go @@ -172,7 +172,7 @@ func brew(cmd *cobra.Command, args []string) { "Issue Type": issueType, "Summary": summary, "Description": description, - "Assignee": jiraUser.AccountID, + "Assignee": assignee(jiraUser), } fields, err := metaIssueType.GetAllFields() @@ -240,6 +240,14 @@ func brew(cmd *cobra.Command, args []string) { } } +func assignee(jiraUser *jira.User) string { + if len(jiraUser.AccountID) > 0 { + return jiraUser.AccountID + } else { + return jiraUser.Name + } +} + func appendAutomaticMetadata(repo *git.Repository, issue *jira.Issue) *jira.Issue { if !autoMetadata { return issue