Skip to content

JiraIssue#getOtherUpdateContext might use wrong update and transition #729

@Marcono1234

Description

@Marcono1234

The Bug

Not completely sure, but Mappers.kt JiraIssue#getOtherUpdateContext might use the wrong update and transition objects:

private fun JiraIssue.getOtherUpdateContext(
jiraClient: JiraClient,
key: String
): Lazy<IssueUpdateContext> =
lazy {
IssueUpdateContextCache.get(key) ?: IssueUpdateContext(
jiraClient,
jiraClient.getIssue(key),
update(),
transition(),
transition()
).also { IssueUpdateContextCache.add(key, it) }
}

Notice how the issue it uses for the IssueUpdateContext is jiraClient.getIssue(key), but update() and transition() are from the (different) issue on which the extension function was invoked.

Expected behavior

update() and transition() should be called on the issue obtained from key?

Might also be good to check whether this can be refactored to reuse JiraIssue.getUpdateContext() (or add a common function for both) to prevent code duplication.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions