Skip to content

Commit 5ac0932

Browse files
fix(slack-trigger): don't drop edit/delete events when channel_type is absent
1 parent 9de9952 commit 5ac0932

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

apps/sim/lib/webhooks/providers/slack.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,18 @@ describe('shouldSkipSlackTriggerEvent', () => {
349349
expect(fires({ eventType: 'message' }, edit)).toBe(false)
350350
})
351351

352+
it('does not drop an edit event that omits channel_type when a Source is selected', () => {
353+
// message_changed payloads often omit channel_type; a Source selection must
354+
// not silently swallow them.
355+
const edit = {
356+
type: 'message',
357+
subtype: 'message_changed',
358+
channel: 'C1',
359+
ts: '3.2',
360+
}
361+
expect(fires({ eventType: 'message_edited', source: ['channel'] }, edit)).toBe(true)
362+
})
363+
352364
it("self-drops the app's own message unless includeOwnMessages is set", () => {
353365
const own = {
354366
type: 'message',

apps/sim/lib/webhooks/providers/slack.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,10 +676,13 @@ export function shouldSkipSlackTriggerEvent(
676676
configuredEvent !== null && slackEventSupportsFilter(configuredEvent, filter)
677677

678678
// Source — restrict a message event to any of DM / public / private
679-
// (multiselect by `channel_type`). Empty means any source.
679+
// (multiselect by `channel_type`). Empty means any source. Only filter when
680+
// the channel_type is actually known: `message_changed` / `message_deleted`
681+
// payloads often omit it, and dropping those on an unknown type would silently
682+
// swallow every edit/delete.
680683
if (supports('source')) {
681684
const sources = normalizeSelection(providerConfig.source)
682-
if (sources.length > 0 && (!channelType || !sources.includes(channelType))) return true
685+
if (sources.length > 0 && channelType && !sources.includes(channelType)) return true
683686
}
684687

685688
// Threads — include / exclude / only.

0 commit comments

Comments
 (0)