feat(ringcentral): restrict selfOnly mode to Personal chat by default
In selfOnly mode, now only allows messages from 'Personal' chat (conversation with yourself). Set allowOtherChats: true to enable DMs and group chats. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
This commit is contained in:
parent
1ceaa31fb3
commit
1d91d0ab73
@ -222,9 +222,20 @@ async function processMessageWithPipeline(params: {
|
||||
}
|
||||
|
||||
// Personal, PersonalChat, Direct are all DM types
|
||||
const isPersonalChat = chatType === "Personal" || chatType === "PersonalChat";
|
||||
const isGroup = chatType !== "Direct" && chatType !== "PersonalChat" && chatType !== "Personal";
|
||||
runtime.log?.(`[${account.accountId}] Chat type: ${chatType}, isGroup: ${isGroup}`);
|
||||
|
||||
// In selfOnly mode, by default only allow "Personal" chat (conversation with yourself)
|
||||
// Set allowOtherChats: true to allow DMs and groups
|
||||
if (selfOnly) {
|
||||
const allowOtherChats = account.config.allowOtherChats === true; // default false
|
||||
if (!allowOtherChats && !isPersonalChat) {
|
||||
logVerbose(core, runtime, `ignore non-personal chat in selfOnly mode: chatType=${chatType}`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const defaultGroupPolicy = config.channels?.defaults?.groupPolicy;
|
||||
const groupPolicy = account.config.groupPolicy ?? defaultGroupPolicy ?? "allowlist";
|
||||
const groupConfigResolved = resolveGroupConfig({
|
||||
|
||||
@ -115,6 +115,7 @@ export type RingCentralAccountConfig = {
|
||||
botExtensionId?: string;
|
||||
replyToMode?: "off" | "all";
|
||||
selfOnly?: boolean; // JWT mode: only accept messages from the JWT user (default: true)
|
||||
allowOtherChats?: boolean; // In selfOnly mode, allow chats other than Personal (default: false)
|
||||
};
|
||||
|
||||
export type RingCentralConfig = RingCentralAccountConfig & {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user