Skip to content

Commit 3c13a29

Browse files
committed
remove @channel, only ping reviewer in thread, no other pings
1 parent d772d94 commit 3c13a29

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/backend/src/utils/slack.utils.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,8 @@ export const sendStandardCRCreatedNotification = async (
603603
): Promise<void> => {
604604
if (process.env.NODE_ENV !== 'production' && !DEV_TESTING_OVERRIDE) return;
605605

606+
const reviewerSlackId = requestedReviewerId ? await getUserSlackId(requestedReviewerId) : undefined;
607+
606608
const message =
607609
wbsElementName !== projectWbsName
608610
? `${submitter.firstName} ${submitter.lastName} submitted a change request for ${wbsElementName} in ${projectWbsName}`
@@ -632,8 +634,6 @@ export const sendStandardCRCreatedNotification = async (
632634
(id): id is string => !!id
633635
);
634636

635-
const reviewerSlackId = requestedReviewerId ? await getUserSlackId(requestedReviewerId) : undefined;
636-
637637
// Also include admins
638638
const admins = await prisma.user.findMany({
639639
where: {
@@ -650,13 +650,13 @@ export const sendStandardCRCreatedNotification = async (
650650

651651
const allSlackIds = new Set([...headSlackIds, ...adminSlackIds, ...(reviewerSlackId ? [reviewerSlackId] : [])]);
652652

653-
const reviewMsg = reviewerSlackId
654-
? `<!channel> <@${reviewerSlackId}> Your review has been requested on CR #${cr.identifier}!`
655-
: `<!channel> Your review has been requested on CR #${cr.identifier}!`;
656-
const crLink = `https://finishlinebyner.com/cr/${cr.crId}`;
657-
await Promise.all(
658-
notifications.map((n) => replyToMessageInThread(n.channelId, n.ts, reviewMsg, crLink, `View CR #${cr.identifier}`))
659-
);
653+
if (reviewerSlackId) {
654+
const reviewMsg = `<@${reviewerSlackId}> Your review has been requested on CR #${cr.identifier}!`;
655+
const crLink = `https://finishlinebyner.com/cr/${cr.crId}`;
656+
await Promise.all(
657+
notifications.map((n) => replyToMessageInThread(n.channelId, n.ts, reviewMsg, crLink, `View CR #${cr.identifier}`))
658+
);
659+
}
660660

661661
// Send the approve button as an ephemeral message to each head and requested reviewer,
662662
// so only authorized approvers see it. reviewChangeRequest still enforces auth on click.

0 commit comments

Comments
 (0)