fix(#709): route Discord threads and approvals
All checks were successful
ci/woodpecker/pr/ci Pipeline was successful

This commit is contained in:
Jarvis
2026-07-13 00:48:53 -05:00
parent 25ed367655
commit 689d5b6870
2 changed files with 33 additions and 3 deletions

View File

@@ -327,15 +327,18 @@ export class DiscordPlugin {
},
this.config.serviceToken,
);
this.socket.emit('message', envelope);
this.socket.emit(content.startsWith('/approve ') ? 'discord:approve' : 'message', envelope);
}
private isAllowedMessage(message: DiscordMessage): boolean {
const guildId = message.guildId;
const parentChannelId = 'parentId' in message.channel ? message.channel.parentId : null;
// Threads inherit their authorization boundary from their configured parent.
const authorizationChannelId = parentChannelId ?? message.channelId;
return (
guildId !== null &&
includesId(this.config.allowedGuildIds, guildId) &&
includesId(this.config.allowedChannelIds, message.channelId) &&
includesId(this.config.allowedChannelIds, authorizationChannelId) &&
includesId(this.config.allowedUserIds, message.author.id)
);
}