Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skipUserResolution for assign_issue to decide whether to skip user resolution or not #1712

Closed
wants to merge 2 commits into from
Closed
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
7 changes: 5 additions & 2 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1875,18 +1875,21 @@ 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
Loading