fix (discord): ignore empty guild channel maps in allowlist resolution

This commit is contained in:
Vignesh Natarajan
2026-02-14 19:04:10 -08:00
parent 202b06b279
commit 7b4984e73d

View File

@@ -308,6 +308,12 @@ function resolveDiscordChannelEntryMatch(
});
}
function hasConfiguredDiscordChannels(
channels: DiscordGuildEntryResolved["channels"] | undefined,
): channels is NonNullable<DiscordGuildEntryResolved["channels"]> {
return Boolean(channels && Object.keys(channels).length > 0);
}
function resolveDiscordChannelConfigEntry(
entry: DiscordChannelEntry,
): DiscordChannelConfigResolved {
@@ -333,7 +339,7 @@ export function resolveDiscordChannelConfig(params: {
}): DiscordChannelConfigResolved | null {
const { guildInfo, channelId, channelName, channelSlug } = params;
const channels = guildInfo?.channels;
if (!channels) {
if (!hasConfiguredDiscordChannels(channels)) {
return null;
}
const match = resolveDiscordChannelEntryMatch(channels, {
@@ -366,7 +372,7 @@ export function resolveDiscordChannelConfigWithFallback(params: {
scope,
} = params;
const channels = guildInfo?.channels;
if (!channels) {
if (!hasConfiguredDiscordChannels(channels)) {
return null;
}
const resolvedParentSlug = parentSlug ?? (parentName ? normalizeDiscordSlug(parentName) : "");