Fix when issue type's name has a translation #437
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem :
When an issue type has a translation for its name, it is impossible to create an issue with that issue type (error appears when the original name and its translation are different).
Indeed, in
Jira Administation / Issues / Issue types
, it is possible to set a translation for each issue type withTranslate Action
.For example, when creating a Bug issue with and without translation (tested with an instance of Atlassian Jira
v8.18.0
) :Cause :
This error message comes from the function
GetIssueCreateMetaIssueType()
inissue.go
:This error happens because when an issue type has a translation on its name, the request
GET .../createmeta
returns data about the issue type only whenissuetypeNames
parameter contains the original name ("Bug" in the example), whereas when searching for the issue type in the response,issueType.Name
is the translation ("Bogue" in the example whenissueTypeName="Bug"
).As a result,
issuetypeName
cannot be found in the response.Solution :
Removing
issuetypeNames
parameter to get every issue types from the project :However, as it get every issue types with the
expand
parameter, a lot more useless data is also downloaded.Another solution would be to keep the original request, but when the issue type is not found, this other request would be used.
I don't know what would be better.
In this fix, I made the easiest but probably not the cleanest solution.