From 863065792e39897f1b40040bd347bc1609e0bc82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= <76261501+zecakeh@users.noreply.github.com> Date: Wed, 19 Jun 2024 19:28:51 +0200 Subject: [PATCH] Fix rendering of comments of GitLab merge requests (#937) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix rendering of comments of GitLab merge requests Signed-off-by: Kévin Commaille * Add changelog Signed-off-by: Kévin Commaille * Change variable name to appease linter Signed-off-by: Kévin Commaille --------- Signed-off-by: Kévin Commaille --- changelog.d/937.bugfix | 1 + src/Connections/GitlabRepo.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelog.d/937.bugfix diff --git a/changelog.d/937.bugfix b/changelog.d/937.bugfix new file mode 100644 index 00000000..617273e8 --- /dev/null +++ b/changelog.d/937.bugfix @@ -0,0 +1 @@ +Fix rendering of comments of GitLab merge requests. \ No newline at end of file diff --git a/src/Connections/GitlabRepo.ts b/src/Connections/GitlabRepo.ts index d4d7fad1..05e3eb9b 100644 --- a/src/Connections/GitlabRepo.ts +++ b/src/Connections/GitlabRepo.ts @@ -785,14 +785,18 @@ ${data.description}`; const target = relation ? '' : ` MR [${orgRepoName}!${mergeRequest.iid}](${mergeRequest.url}): "${mergeRequest.title}"`; let content = `**${result.author}** ${action}${target} ${comments}`; + let formatted = ''; if (result.commentNotes) { content += "\n\n> " + result.commentNotes.join("\n\n> "); + formatted = md.render(content); + } else { + formatted = md.renderInline(content); } const eventPromise = this.intent.sendEvent(this.roomId, { msgtype: "m.notice", body: content, - formatted_body: md.renderInline(content), + formatted_body: formatted, format: "org.matrix.custom.html", ...relation, }).catch(ex => {