mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 10:57:40 +00:00
refactor: dedupe shared helpers across ui/gateway/extensions
This commit is contained in:
@@ -11,6 +11,7 @@ import type {
|
||||
import {
|
||||
buildChannelKeyCandidates,
|
||||
normalizeChannelSlug,
|
||||
resolveAllowlistMatchSimple,
|
||||
resolveToolsBySender,
|
||||
resolveChannelEntryMatchWithFallback,
|
||||
resolveNestedAllowlistDecision,
|
||||
@@ -209,24 +210,7 @@ export function resolveMSTeamsAllowlistMatch(params: {
|
||||
senderId: string;
|
||||
senderName?: string | null;
|
||||
}): MSTeamsAllowlistMatch {
|
||||
const allowFrom = params.allowFrom
|
||||
.map((entry) => String(entry).trim().toLowerCase())
|
||||
.filter(Boolean);
|
||||
if (allowFrom.length === 0) {
|
||||
return { allowed: false };
|
||||
}
|
||||
if (allowFrom.includes("*")) {
|
||||
return { allowed: true, matchKey: "*", matchSource: "wildcard" };
|
||||
}
|
||||
const senderId = params.senderId.toLowerCase();
|
||||
if (allowFrom.includes(senderId)) {
|
||||
return { allowed: true, matchKey: senderId, matchSource: "id" };
|
||||
}
|
||||
const senderName = params.senderName?.toLowerCase();
|
||||
if (senderName && allowFrom.includes(senderName)) {
|
||||
return { allowed: true, matchKey: senderName, matchSource: "name" };
|
||||
}
|
||||
return { allowed: false };
|
||||
return resolveAllowlistMatchSimple(params);
|
||||
}
|
||||
|
||||
export function resolveMSTeamsReplyPolicy(params: {
|
||||
|
||||
Reference in New Issue
Block a user