Skip to content

Commit 0d1212f

Browse files
Merge pull request #5 from lubomir-dlhy/fix-issue-retrieval
TECH-741: Fix retrieval of jira subtask tickets
2 parents ba4c578 + 9bc1a3f commit 0d1212f

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

src/Jira.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ export default class Jira {
226226
}
227227

228228
/**
229-
* Retreive the jira issue by ID.
229+
* Retrieve the jira issue by ID.
230+
* If the issue is sub-task or sub-bug, return parent task.
230231
*
231232
* @param {String} ticketId - The ticket ID of the issue to retrieve.
232233
* @return {Promise} Resolves a jira issue object
@@ -236,15 +237,12 @@ export default class Jira {
236237
return Promise.reject('Jira is not configured.')
237238
}
238239

239-
return this.jira.findIssue(ticketId).then(async (origTicket) => {
240-
let ticket = Object.assign({}, origTicket)
241-
if (origTicket.fields?.issuetype?.subtask) {
242-
return this.jira.findIssue(origTicket.fields?.parent?.key).then((storyTicket) => {
243-
ticket = Object.assign({}, storyTicket)
244-
})
245-
}
246-
return ticket
247-
})
240+
let ticket = await this.jira.findIssue(ticketId)
241+
242+
if (ticket?.fields?.issuetype?.subtask) {
243+
ticket = await this.jira.findIssue(ticket?.fields?.parent?.key)
244+
}
245+
return ticket
248246
}
249247

250248
/**

0 commit comments

Comments
 (0)