refactor: share allowFrom stringification helpers

This commit is contained in:
Peter Steinberger
2026-03-07 23:24:45 +00:00
parent 99d14a820a
commit c5bd84309a
7 changed files with 16 additions and 16 deletions

View File

@@ -8,6 +8,7 @@ import {
logAckFailure,
logInboundDrop,
logTypingFailure,
mapAllowFromEntries,
readStoreAllowFromForDmPolicy,
recordPendingHistoryEntryIfEnabled,
resolveAckReaction,
@@ -510,7 +511,7 @@ export async function processMessage(
const dmPolicy = account.config.dmPolicy ?? "pairing";
const groupPolicy = account.config.groupPolicy ?? "allowlist";
const configuredAllowFrom = (account.config.allowFrom ?? []).map((entry) => String(entry));
const configuredAllowFrom = mapAllowFromEntries(account.config.allowFrom);
const storeAllowFrom = await readStoreAllowFromForDmPolicy({
provider: "bluebubbles",
accountId: account.accountId,

View File

@@ -159,10 +159,8 @@ export const zaloPlugin: ChannelPlugin<ResolvedZaloAccount> = {
if (groupPolicy !== "open") {
return [];
}
const explicitGroupAllowFrom = (account.config.groupAllowFrom ?? []).map((entry) =>
String(entry),
);
const dmAllowFrom = (account.config.allowFrom ?? []).map((entry) => String(entry));
const explicitGroupAllowFrom = mapAllowFromEntries(account.config.groupAllowFrom);
const dmAllowFrom = mapAllowFromEntries(account.config.allowFrom);
const effectiveAllowFrom =
explicitGroupAllowFrom.length > 0 ? explicitGroupAllowFrom : dmAllowFrom;
if (effectiveAllowFrom.length > 0) {