Skip to content

Commit 708e8f8

Browse files
authored
Enhanced set_issue_status method in jira module, adding update param (#721)
* Enhanced set_issue_status in jira module, by adding 'update' parameter as supported by latest Jira Rest API * Update jira.py * Formatted with black
1 parent b38c4fe commit 708e8f8

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

atlassian/bamboo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def results(
357357
elements_key="results",
358358
element_key="result",
359359
label=label,
360-
**params
360+
**params,
361361
)
362362

363363
def latest_results(

atlassian/jira.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,21 +1120,27 @@ def get_issue_transitions(self, issue_key):
11201120
def issue_transition(self, issue_key, status):
11211121
return self.set_issue_status(issue_key, status)
11221122

1123-
def set_issue_status(self, issue_key, status_name, fields=None):
1123+
def set_issue_status(self, issue_key, status_name, fields=None, update=None):
11241124
"""
11251125
Setting status by status_name. fields defaults to None for transitions without mandatory fields.
1126-
If there are mandatary fields for the transition, these can be set using a dict.
1126+
If there are mandatory fields for the transition, these can be set using a dict in 'fields'.
1127+
For updating screen properties that cannot be set/updated via the fields properties,
1128+
they can set using a dict through 'update'
11271129
Example:
1128-
jira.set_issue_status('MY-123','Resolved',{'myfield': 'myvalue'})
1130+
jira.set_issue_status('MY-123','Resolved',{'myfield': 'myvalue'},
1131+
{"comment": [{"add": { "body": "Issue Comments"}}]})
11291132
:param issue_key: str
11301133
:param status_name: str
11311134
:param fields: dict, optional
1135+
:param update: dict, optional
11321136
"""
11331137
url = "rest/api/2/issue/{issue_key}/transitions".format(issue_key=issue_key)
11341138
transition_id = self.get_transition_id_to_status_name(issue_key, status_name)
11351139
data = {"transition": {"id": transition_id}}
11361140
if fields is not None:
11371141
data["fields"] = fields
1142+
if update is not None:
1143+
data["update"] = update
11381144
return self.post(url, data=data)
11391145

11401146
def set_issue_status_by_transition_id(self, issue_key, transition_id):

0 commit comments

Comments
 (0)