File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff 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 /**
You can’t perform that action at this time.
0 commit comments