Skip to content

Commit

Permalink
fix: Issue with epic field on create
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitpokhrel committed Apr 28, 2023
1 parent d59cc82 commit c1076d7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/jira/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package jira
import (
"context"
"encoding/json"
"fmt"
"net/http"
"strconv"
"strings"
Expand Down Expand Up @@ -82,6 +83,8 @@ func (c *Client) create(req *CreateRequest, ver string) (*CreateResponse, error)
return nil, err
}

fmt.Printf("\n%+v\n", string(body))

header := Header{
"Accept": "application/json",
"Content-Type": "application/json",
Expand Down Expand Up @@ -309,10 +312,12 @@ func (cfm *createFieldsMarshaler) MarshalJSON() ([]byte, error) {
}
dm := temp.(map[string]interface{})

if cfm.M.epicField != "" {
dm[cfm.M.epicField] = dm["name"]
if epic, ok := dm["name"]; ok {
if cfm.M.epicField != "" {
dm[cfm.M.epicField] = epic
}
delete(dm, "name")
}
delete(dm, "name")

for key, val := range cfm.M.customFields {
dm[key] = val
Expand Down

0 comments on commit c1076d7

Please sign in to comment.