mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 10:41:25 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -8,8 +8,12 @@ type ChannelConfigWithAccounts = {
|
||||
};
|
||||
|
||||
function resolveAccountConfig(accounts: ChannelConfigWithAccounts["accounts"], accountId: string) {
|
||||
if (!accounts || typeof accounts !== "object") return undefined;
|
||||
if (accountId in accounts) return accounts[accountId];
|
||||
if (!accounts || typeof accounts !== "object") {
|
||||
return undefined;
|
||||
}
|
||||
if (accountId in accounts) {
|
||||
return accounts[accountId];
|
||||
}
|
||||
const matchKey = Object.keys(accounts).find(
|
||||
(key) => key.toLowerCase() === accountId.toLowerCase(),
|
||||
);
|
||||
@@ -21,10 +25,14 @@ export function resolveChannelConfigWrites(params: {
|
||||
channelId?: ChannelId | null;
|
||||
accountId?: string | null;
|
||||
}): boolean {
|
||||
if (!params.channelId) return true;
|
||||
if (!params.channelId) {
|
||||
return true;
|
||||
}
|
||||
const channels = params.cfg.channels as Record<string, ChannelConfigWithAccounts> | undefined;
|
||||
const channelConfig = channels?.[params.channelId];
|
||||
if (!channelConfig) return true;
|
||||
if (!channelConfig) {
|
||||
return true;
|
||||
}
|
||||
const accountId = normalizeAccountId(params.accountId);
|
||||
const accountConfig = resolveAccountConfig(channelConfig.accounts, accountId);
|
||||
const value = accountConfig?.configWrites ?? channelConfig.configWrites;
|
||||
|
||||
Reference in New Issue
Block a user