Skip to content

Commit

Permalink
Add skipUserResolution for assign_issue to deside whether to skip use…
Browse files Browse the repository at this point in the history
…r resolution or not
  • Loading branch information
yaooqinn committed Aug 15, 2023
1 parent da00ec0 commit 97a09d2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1875,18 +1875,23 @@ def _get_user_id(self, user: str | None) -> str | None:

# non-resource
@translate_resource_args
def assign_issue(self, issue: int | str, assignee: str | None) -> bool:
def assign_issue(
self,
issue: int | str,
assignee: str | None,
skipUserResolution: bool = False) -> bool:
"""Assign an issue to a user.
Args:
issue (Union[int, str]): the issue ID or key to assign
assignee (str): the user to assign the issue to. None will set it to unassigned. -1 will set it to Automatic.
skipUserResolution (bool): when true, use the username from caller side directly to assign issue
Returns:
bool
"""
url = self._get_latest_url(f"issue/{issue}/assignee")
user_id = self._get_user_id(assignee)
user_id = assignee if skipUserResolution else self._get_user_id(assignee)
payload = {"accountId": user_id} if self._is_cloud else {"name": user_id}
self._session.put(url, data=json.dumps(payload))
return True
Expand Down

0 comments on commit 97a09d2

Please sign in to comment.