mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 01:52:44 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -4,9 +4,15 @@ import type { NativeCommandsSetting } from "./types.js";
|
||||
|
||||
function resolveAutoDefault(providerId?: ChannelId): boolean {
|
||||
const id = normalizeChannelId(providerId);
|
||||
if (!id) return false;
|
||||
if (id === "discord" || id === "telegram") return true;
|
||||
if (id === "slack") return false;
|
||||
if (!id) {
|
||||
return false;
|
||||
}
|
||||
if (id === "discord" || id === "telegram") {
|
||||
return true;
|
||||
}
|
||||
if (id === "slack") {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -17,8 +23,12 @@ export function resolveNativeSkillsEnabled(params: {
|
||||
}): boolean {
|
||||
const { providerId, providerSetting, globalSetting } = params;
|
||||
const setting = providerSetting === undefined ? globalSetting : providerSetting;
|
||||
if (setting === true) return true;
|
||||
if (setting === false) return false;
|
||||
if (setting === true) {
|
||||
return true;
|
||||
}
|
||||
if (setting === false) {
|
||||
return false;
|
||||
}
|
||||
return resolveAutoDefault(providerId);
|
||||
}
|
||||
|
||||
@@ -29,8 +39,12 @@ export function resolveNativeCommandsEnabled(params: {
|
||||
}): boolean {
|
||||
const { providerId, providerSetting, globalSetting } = params;
|
||||
const setting = providerSetting === undefined ? globalSetting : providerSetting;
|
||||
if (setting === true) return true;
|
||||
if (setting === false) return false;
|
||||
if (setting === true) {
|
||||
return true;
|
||||
}
|
||||
if (setting === false) {
|
||||
return false;
|
||||
}
|
||||
// auto or undefined -> heuristic
|
||||
return resolveAutoDefault(providerId);
|
||||
}
|
||||
@@ -40,7 +54,11 @@ export function isNativeCommandsExplicitlyDisabled(params: {
|
||||
globalSetting?: NativeCommandsSetting;
|
||||
}): boolean {
|
||||
const { providerSetting, globalSetting } = params;
|
||||
if (providerSetting === false) return true;
|
||||
if (providerSetting === undefined) return globalSetting === false;
|
||||
if (providerSetting === false) {
|
||||
return true;
|
||||
}
|
||||
if (providerSetting === undefined) {
|
||||
return globalSetting === false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user