Skip to content

Commit

Permalink
Fix rendering of comments of GitLab merge requests (#937)
Browse files Browse the repository at this point in the history
* Fix rendering of comments of GitLab merge requests

Signed-off-by: Kévin Commaille <[email protected]>

* Add changelog

Signed-off-by: Kévin Commaille <[email protected]>

* Change variable name to appease linter

Signed-off-by: Kévin Commaille <[email protected]>

---------

Signed-off-by: Kévin Commaille <[email protected]>
  • Loading branch information
zecakeh authored Jun 19, 2024
1 parent 7573d37 commit 8630657
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/937.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix rendering of comments of GitLab merge requests.
6 changes: 5 additions & 1 deletion src/Connections/GitlabRepo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down

0 comments on commit 8630657

Please sign in to comment.