Skip to content

Commit 75afd41

Browse files
authored
Fixes #989: Remove markdown conversion for summary field (#990)
* Fixes #989, ran format * coalesce to empty string
1 parent a3225b8 commit 75afd41

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

jbi/jira/service.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,14 @@ def update_issue_status(self, context: ActionContext, jira_status: str):
292292

293293
def update_issue_summary(self, context: ActionContext):
294294
"""Update's an issue's summary with the description of an incoming bug"""
295-
truncated_summary = markdown_to_jira(
296-
context.bug.summary or "", max_length=JIRA_DESCRIPTION_CHAR_LIMIT
297-
)
295+
truncated_summary = context.bug.summary or ""
296+
297+
if len(truncated_summary) > JIRA_DESCRIPTION_CHAR_LIMIT:
298+
# Truncate on last word.
299+
truncated_summary = truncated_summary[:JIRA_DESCRIPTION_CHAR_LIMIT].rsplit(
300+
maxsplit=1
301+
)[0]
302+
298303
return self.update_issue_field(
299304
context, field="summary", value=truncated_summary
300305
)

jbi/queue.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,9 @@ async def remove(self, bug_id: int, identifier: str):
188188
logger.debug("Removing %s from queue for bug %s", identifier, bug_id)
189189
item_path.unlink()
190190
except FileNotFoundError as exc:
191-
logger.warning("Could not delete missing item at path %s", str(item_path), exc)
191+
logger.warning(
192+
"Could not delete missing item at path %s", str(item_path), exc
193+
)
192194

193195
if not any(bug_dir.iterdir()):
194196
bug_dir.rmdir()

tests/unit/test_steps.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ def test_modified_public(
150150
action_context = action_context_factory(
151151
operation=Operation.UPDATE,
152152
bug__see_also=["https://mozilla.atlassian.net/browse/JBI-234"],
153-
bug__summary="JBI [Test](http://test.com)",
153+
bug__summary="[JBI] (Test)",
154154
jira__issue="JBI-234",
155155
event__changes=[
156156
webhook_event_change_factory(
157-
field="summary", removed="", added="JBI [Test](http://test.com)"
157+
field="summary", removed="", added="[JBI] (Test)"
158158
)
159159
],
160160
)
@@ -171,7 +171,7 @@ def test_modified_public(
171171

172172
mocked_jira.update_issue_field.assert_called_once_with(
173173
key="JBI-234",
174-
fields={"summary": "JBI [Test|http://test.com]"},
174+
fields={"summary": "[JBI] (Test)"},
175175
)
176176

177177

0 commit comments

Comments
 (0)