refactor: simplify discord allow-list normalization

This commit is contained in:
Peter Steinberger
2026-04-11 00:00:59 +01:00
parent 1c0e444f56
commit 97df07ed9a

View File

@@ -60,9 +60,9 @@ export function normalizeDiscordAllowList(raw: string[] | undefined, prefixes: s
}
const ids = new Set<string>();
const names = new Set<string>();
const allowAll = raw.some((entry) => (normalizeOptionalString(String(entry)) ?? "") === "*");
const allowAll = raw.some((entry) => (normalizeOptionalString(entry) ?? "") === "*");
for (const entry of raw) {
const text = normalizeOptionalString(String(entry)) ?? "";
const text = normalizeOptionalString(entry) ?? "";
if (!text || text === "*") {
continue;
}
@@ -564,7 +564,7 @@ export function resolveGroupDmAllow(params: {
if (!channels || channels.length === 0) {
return true;
}
const allowList = new Set(channels.map((entry) => normalizeDiscordSlug(String(entry))));
const allowList = new Set(channels.map((entry) => normalizeDiscordSlug(entry)));
const candidates = [
normalizeDiscordSlug(channelId),
channelSlug,