Skip to content

Commit

Permalink
fix: send only summary for large slack notifications (wundergraph#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisnithin authored Feb 19, 2024
1 parent c56ce3c commit 732dbc5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions controlplane/src/core/webhooks/OrganizationWebhookService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,23 @@ export class OrganizationWebhookService {
(c) => c.changeType.includes('ADDED') || c.changeType.includes('CHANGED'),
);
const removedChanges = latestChangelogs.changelogs.filter((c) => c.changeType.includes('REMOVED'));

if (removedChanges.length + addedChanges.length > 20) {
tempData.attachments.unshift({
color: '#e11d48',
blocks: [
{
type: 'section',
text: {
type: 'mrkdwn',
text: `Too many changes to display. There were ${removedChanges.length} deletions and ${addedChanges.length} additions.`,
},
},
],
});
return tempData;
}

if (removedChanges.length > 0) {
tempData.attachments.unshift({
color: '#e11d48',
Expand Down

0 comments on commit 732dbc5

Please sign in to comment.