Skip to content

Commit

Permalink
fix: multiple slack notifications (#10190)
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Krick <matt.krick@gmail.com>
  • Loading branch information
mattkrick authored Sep 6, 2024
1 parent 9148205 commit c4444ef
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/server/dataloader/integrationAuthLoaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export const slackNotificationsByTeamIdAndEvent = (parent: RootDataLoader) => {
.flat()

return keys.map((key) => {
const usedChannelIds = new Set<string>()
return res
.filter((doc) => doc.teamId === key.teamId && doc.event === key.event)
.map((notification) => {
Expand All @@ -200,6 +201,11 @@ export const slackNotificationsByTeamIdAndEvent = (parent: RootDataLoader) => {
}
})
.filter(isValid)
.filter(({channelId}) => {
if (!channelId || usedChannelIds.has(channelId)) return false
usedChannelIds.add(channelId)
return true
})
})
})
}

0 comments on commit c4444ef

Please sign in to comment.