Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2998,23 +2998,31 @@ def create_issue_link(
# let's see if we have the right issue link 'type' and fix it if needed
issue_link_types = self.issue_link_types()

if type not in issue_link_types:
self.log.warning(
"Warning: Specified issue link type is not present in the list of link types"
)
if isinstance(type, str):
for lt in issue_link_types:
if lt.outward == type:
if lt.outward == type or lt.name == type:
# we are smart to figure it out what he meant
type = lt.name
type = lt
break
elif lt.inward == type:
# so that's the reverse, so we fix the request
type = lt.name
type = lt
inwardIssue, outwardIssue = outwardIssue, inwardIssue
break
else:
self.log.warning(
f"Warning: Specified issue link type {type} is not present in the list of link types"
)
type = IssueLinkType(self._options, self._session, {"name": type})
elif not isinstance(type, IssueLinkType):
raise TypeError("The specified issue link type is not valid")
elif type not in issue_link_types:
self.log.warning(
"Warning: Specified issue link type is not present in the list of link types"
)

data = {
"type": {"name": type},
"type": type.raw,
"inwardIssue": {"key": inwardIssue},
"outwardIssue": {"key": outwardIssue},
"comment": comment,
Expand Down
Loading