mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 01:23:29 +00:00
refactor(onboarding): reuse allowlist merge across channels
This commit is contained in:
@@ -15,7 +15,7 @@ import {
|
||||
resolveDefaultWhatsAppAccountId,
|
||||
resolveWhatsAppAuthDir,
|
||||
} from "../../../web/accounts.js";
|
||||
import { promptAccountId } from "./helpers.js";
|
||||
import { mergeAllowFromEntries, promptAccountId } from "./helpers.js";
|
||||
|
||||
const channel = "whatsapp" as const;
|
||||
|
||||
@@ -72,10 +72,10 @@ async function promptWhatsAppOwnerAllowFrom(params: {
|
||||
...existingAllowFrom
|
||||
.filter((item) => item !== "*")
|
||||
.map((item) => normalizeE164(item))
|
||||
.filter(Boolean),
|
||||
.filter((item): item is string => typeof item === "string" && item.trim().length > 0),
|
||||
normalized,
|
||||
];
|
||||
const allowFrom = [...new Set(merged.filter(Boolean))];
|
||||
const allowFrom = mergeAllowFromEntries(undefined, merged);
|
||||
return { normalized, allowFrom };
|
||||
}
|
||||
|
||||
@@ -234,8 +234,10 @@ async function promptWhatsAppAllowFrom(
|
||||
.split(/[\n,;]+/g)
|
||||
.map((p) => p.trim())
|
||||
.filter(Boolean);
|
||||
const normalized = parts.map((part) => (part === "*" ? "*" : normalizeE164(part)));
|
||||
const unique = [...new Set(normalized.filter(Boolean))];
|
||||
const normalized = parts
|
||||
.map((part) => (part === "*" ? "*" : normalizeE164(part)))
|
||||
.filter((part): part is string => typeof part === "string" && part.trim().length > 0);
|
||||
const unique = mergeAllowFromEntries(undefined, normalized);
|
||||
next = setWhatsAppAllowFrom(next, unique);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user