Skip to content

Commit e8dccdb

Browse files
authored
Ref #1055: use update field in payload for comments (#1063)
* Ref #1055: use update field in payload for comments * Fix typing inference
1 parent 2c3f5de commit e8dccdb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

jbi/jira/service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,14 @@ def update_issue_status(self, context: ActionContext, jira_status: str):
290290
issue_key = context.jira.issue
291291
assert issue_key # Until we have more fine-grained typing of contexts
292292

293-
kwargs = {}
293+
kwargs: dict[str, Any] = {}
294294
if jira_status == "Cancelled":
295295
kwargs["fields"] = {
296-
"comment": "Issue was cancelled.",
297296
"resolution": {"name": "Invalid"},
298297
}
298+
kwargs["update"] = {
299+
"comment": [{"add": {"body": "Issue was cancelled."}}],
300+
}
299301

300302
logger.info(
301303
"Updating Jira status to %s",

tests/unit/jira/test_service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,11 @@ def test_update_issue_status_adds_comment_and_resolution_when_cancelled(
193193
{
194194
"transition": {"id": 42},
195195
"fields": {
196-
"comment": "Issue was cancelled.",
197196
"resolution": {"name": "Invalid"},
198197
},
198+
"update": {
199+
"comment": [{"add": {"body": "Issue was cancelled."}}],
200+
},
199201
}
200202
)
201203
],

0 commit comments

Comments
 (0)