diff --git a/changelog.d/954.misc b/changelog.d/954.misc new file mode 100644 index 000000000..e4369a4e8 --- /dev/null +++ b/changelog.d/954.misc @@ -0,0 +1 @@ +Change GitLab webhook's messages to be more consistent with GitHub webhook's. diff --git a/src/Connections/GitlabRepo.ts b/src/Connections/GitlabRepo.ts index 05e3eb9bf..bb6cf18b4 100644 --- a/src/Connections/GitlabRepo.ts +++ b/src/Connections/GitlabRepo.ts @@ -19,6 +19,8 @@ import { GitLabClient } from "../Gitlab/Client"; import { IBridgeStorageProvider } from "../Stores/StorageProvider"; import axios from "axios"; import { GitLabGrantChecker } from "../Gitlab/GrantChecker"; +import { FormatUtil } from "../FormatUtil"; +import { emojify } from "node-emoji"; export interface GitLabRepoConnectionState extends IConnectionState { instance: string; @@ -558,11 +560,15 @@ export class GitLabRepoConnection extends CommandConnection ({ name: l.title, description: l.description || undefined, color: l.color || undefined }))); await this.intent.sendEvent(this.roomId, { msgtype: "m.notice", - body: content, - formatted_body: md.renderInline(content), + body: content + (labels.plain.length > 0 ? ` with labels ${labels.plain}`: ""), + formatted_body: md.renderInline(content) + (labels.html.length > 0 ? ` with labels ${labels.html}`: ""), format: "org.matrix.custom.html", }); } @@ -574,7 +580,7 @@ export class GitLabRepoConnection extends CommandConnection "); + content += "\n\n> " + emojify(result.commentNotes.join("\n\n> ")); formatted = md.render(content); } else { formatted = md.renderInline(content); diff --git a/src/Gitlab/WebhookTypes.ts b/src/Gitlab/WebhookTypes.ts index ac302e9f9..913a6aa7d 100644 --- a/src/Gitlab/WebhookTypes.ts +++ b/src/Gitlab/WebhookTypes.ts @@ -40,6 +40,7 @@ export interface IGitlabMergeRequest { export interface IGitLabMergeRequestObjectAttributes extends IGitlabMergeRequest { action: "open"|"close"|"reopen"|"approved"|"unapproved"|"merge"; + draft: boolean; } export interface IGitLabLabel {