Skip to content

Commit 60ccc04

Browse files
authored
Fix the symbol used to prefix GitLab merge requests (#938)
* Fix the symbol used to prefix GitLab merge requests Signed-off-by: Kévin Commaille <[email protected]> * Add changelog Signed-off-by: Kévin Commaille <[email protected]> --------- Signed-off-by: Kévin Commaille <[email protected]>
1 parent 2bffd5c commit 60ccc04

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

changelog.d/938.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix the symbol used to prefix GitLab merge requests.

src/Connections/GitlabRepo.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -555,10 +555,10 @@ export class GitLabRepoConnection extends CommandConnection<GitLabRepoConnection
555555
if (this.hookFilter.shouldSkip('merge_request', 'merge_request.open') || !this.matchesLabelFilter(event)) {
556556
return;
557557
}
558-
log.info(`onMergeRequestOpened ${this.roomId} ${this.path} #${event.object_attributes.iid}`);
558+
log.info(`onMergeRequestOpened ${this.roomId} ${this.path} !${event.object_attributes.iid}`);
559559
this.validateMREvent(event);
560560
const orgRepoName = event.project.path_with_namespace;
561-
const content = `**${event.user.username}** opened a new MR [${orgRepoName}#${event.object_attributes.iid}](${event.object_attributes.url}): "${event.object_attributes.title}"`;
561+
const content = `**${event.user.username}** opened a new MR [${orgRepoName}!${event.object_attributes.iid}](${event.object_attributes.url}): "${event.object_attributes.title}"`;
562562
await this.intent.sendEvent(this.roomId, {
563563
msgtype: "m.notice",
564564
body: content,
@@ -571,10 +571,10 @@ export class GitLabRepoConnection extends CommandConnection<GitLabRepoConnection
571571
if (this.hookFilter.shouldSkip('merge_request', 'merge_request.reopen') || !this.matchesLabelFilter(event)) {
572572
return;
573573
}
574-
log.info(`onMergeRequestReopened ${this.roomId} ${this.path} #${event.object_attributes.iid}`);
574+
log.info(`onMergeRequestReopened ${this.roomId} ${this.path} !${event.object_attributes.iid}`);
575575
this.validateMREvent(event);
576576
const orgRepoName = event.project.path_with_namespace;
577-
const content = `**${event.user.username}** reopened MR [${orgRepoName}#${event.object_attributes.iid}](${event.object_attributes.url}): "${event.object_attributes.title}"`;
577+
const content = `**${event.user.username}** reopened MR [${orgRepoName}!${event.object_attributes.iid}](${event.object_attributes.url}): "${event.object_attributes.title}"`;
578578
await this.intent.sendEvent(this.roomId, {
579579
msgtype: "m.notice",
580580
body: content,
@@ -587,10 +587,10 @@ export class GitLabRepoConnection extends CommandConnection<GitLabRepoConnection
587587
if (this.hookFilter.shouldSkip('merge_request', 'merge_request.close') || !this.matchesLabelFilter(event)) {
588588
return;
589589
}
590-
log.info(`onMergeRequestClosed ${this.roomId} ${this.path} #${event.object_attributes.iid}`);
590+
log.info(`onMergeRequestClosed ${this.roomId} ${this.path} !${event.object_attributes.iid}`);
591591
this.validateMREvent(event);
592592
const orgRepoName = event.project.path_with_namespace;
593-
const content = `**${event.user.username}** closed MR [${orgRepoName}#${event.object_attributes.iid}](${event.object_attributes.url}): "${event.object_attributes.title}"`;
593+
const content = `**${event.user.username}** closed MR [${orgRepoName}!${event.object_attributes.iid}](${event.object_attributes.url}): "${event.object_attributes.title}"`;
594594
await this.intent.sendEvent(this.roomId, {
595595
msgtype: "m.notice",
596596
body: content,
@@ -603,10 +603,10 @@ export class GitLabRepoConnection extends CommandConnection<GitLabRepoConnection
603603
if (this.hookFilter.shouldSkip('merge_request', 'merge_request.merge') || !this.matchesLabelFilter(event)) {
604604
return;
605605
}
606-
log.info(`onMergeRequestMerged ${this.roomId} ${this.path} #${event.object_attributes.iid}`);
606+
log.info(`onMergeRequestMerged ${this.roomId} ${this.path} !${event.object_attributes.iid}`);
607607
this.validateMREvent(event);
608608
const orgRepoName = event.project.path_with_namespace;
609-
const content = `**${event.user.username}** merged MR [${orgRepoName}#${event.object_attributes.iid}](${event.object_attributes.url}): "${event.object_attributes.title}"`;
609+
const content = `**${event.user.username}** merged MR [${orgRepoName}!${event.object_attributes.iid}](${event.object_attributes.url}): "${event.object_attributes.title}"`;
610610
await this.intent.sendEvent(this.roomId, {
611611
msgtype: "m.notice",
612612
body: content,
@@ -619,7 +619,7 @@ export class GitLabRepoConnection extends CommandConnection<GitLabRepoConnection
619619
if (this.hookFilter.shouldSkip('merge_request', 'merge_request.ready_for_review')) {
620620
return;
621621
}
622-
log.info(`onMergeRequestUpdate ${this.roomId} ${this.instance}/${this.path} ${event.object_attributes.iid}`);
622+
log.info(`onMergeRequestUpdate ${this.roomId} ${this.instance}/${this.path} !${event.object_attributes.iid}`);
623623
this.validateMREvent(event);
624624
// Check if the MR changed to / from a draft
625625
if (!event.changes.draft) {
@@ -630,10 +630,10 @@ export class GitLabRepoConnection extends CommandConnection<GitLabRepoConnection
630630
const isDraft = event.changes.draft.current;
631631
if (!isDraft) {
632632
// Ready for review
633-
content = `**${event.user.username}** marked MR [${orgRepoName}#${event.object_attributes.iid}](${event.object_attributes.url}) as ready for review "${event.object_attributes.title}" `;
633+
content = `**${event.user.username}** marked MR [${orgRepoName}!${event.object_attributes.iid}](${event.object_attributes.url}) as ready for review "${event.object_attributes.title}" `;
634634
} else {
635635
// Back to draft.
636-
content = `**${event.user.username}** marked MR [${orgRepoName}#${event.object_attributes.iid}](${event.object_attributes.url}) as draft "${event.object_attributes.title}" `;
636+
content = `**${event.user.username}** marked MR [${orgRepoName}!${event.object_attributes.iid}](${event.object_attributes.url}) as draft "${event.object_attributes.title}" `;
637637
}
638638
await this.intent.sendEvent(this.roomId, {
639639
msgtype: "m.notice",
@@ -782,7 +782,7 @@ ${data.description}`;
782782
action = '🔴 unapproved';
783783
}
784784

785-
const target = relation ? '' : ` MR [${orgRepoName}#${mergeRequest.iid}](${mergeRequest.url}): "${mergeRequest.title}"`;
785+
const target = relation ? '' : ` MR [${orgRepoName}!${mergeRequest.iid}](${mergeRequest.url}): "${mergeRequest.title}"`;
786786
let content = `**${result.author}** ${action}${target} ${comments}`;
787787

788788
if (result.commentNotes) {
@@ -859,7 +859,7 @@ ${data.description}`;
859859
if (this.hookFilter.shouldSkip('merge_request', 'merge_request.review', `merge_request.${event.object_attributes.action}`) || !this.matchesLabelFilter(event)) {
860860
return;
861861
}
862-
log.info(`onMergeRequestReviewed ${this.roomId} ${this.instance}/${this.path} ${event.object_attributes.iid}`);
862+
log.info(`onMergeRequestReviewed ${this.roomId} ${this.instance}/${this.path} !${event.object_attributes.iid}`);
863863
this.validateMREvent(event);
864864
this.debounceMergeRequestReview(
865865
event.user,
@@ -879,7 +879,7 @@ ${data.description}`;
879879
return;
880880
}
881881

882-
log.info(`onMergeRequestReviewed ${this.roomId} ${this.instance}/${this.path} ${event.object_attributes.iid}`);
882+
log.info(`onMergeRequestReviewed ${this.roomId} ${this.instance}/${this.path} !${event.object_attributes.iid}`);
883883
this.validateMREvent(event);
884884
this.debounceMergeRequestReview(
885885
event.user,
@@ -897,7 +897,7 @@ ${data.description}`;
897897
if (this.hookFilter.shouldSkip('merge_request', 'merge_request.review')) {
898898
return;
899899
}
900-
log.info(`onCommentCreated ${this.roomId} ${this.toString()} ${event.merge_request?.iid} ${event.object_attributes.id}`);
900+
log.info(`onCommentCreated ${this.roomId} ${this.toString()} !${event.merge_request?.iid} ${event.object_attributes.id}`);
901901
if (!event.merge_request || event.object_attributes.noteable_type !== "MergeRequest") {
902902
// Not a MR comment
903903
return;

0 commit comments

Comments
 (0)