Skip to content

Commit

Permalink
Fix moving issues between backlog and sprints (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximilianruesch authored Dec 3, 2023
1 parent 7273237 commit 6d3ee25
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions electron/providers/jira-server-provider/JiraServerProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,24 +291,16 @@ export class JiraServerProvider implements IProvider {
async moveIssueToSprintAndRank(
sprint: number,
issue: string,
rankBefore: string,
rankAfter: string
): Promise<void> {
return new Promise((resolve, reject) => {
const rankCustomField = this.customFields.get("Rank")
this.getAgileRestApiClient('1.0')
.post(
`/sprint/${sprint}/issue`,
{
rankCustomFieldId: rankCustomField!.match(/_(\d+)/)![1],
issues: [issue],
...(rankAfter && { rankAfterIssue: rankAfter }),
...(rankBefore && { rankBeforeIssue: rankBefore }),
}
{ issues: [issue] } // Ranking issues in the sprints is not supported by Jira server
)
.then(() => resolve())
.catch((error) => {
reject(new Error(`Error in moving this issue to the Sprint with id ${sprint}: ${error}`))
reject(new Error(`Error in moving this issue to the Sprint with id ${sprint}: ${JSON.stringify(error.response.data)}`))
})
})
}
Expand Down Expand Up @@ -352,7 +344,7 @@ export class JiraServerProvider implements IProvider {
.put('/issue/rank', body)
.then(() => resolve())
.catch((error) =>
reject(new Error(`Error in moving this issue to the Backlog: ${error}`))
reject(new Error(`Error in ranking this issue in the Backlog: ${error}`))
)
})
}
Expand Down

0 comments on commit 6d3ee25

Please sign in to comment.