mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 18:14:31 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -125,7 +125,9 @@ export function getChatChannelMeta(id: ChatChannelId): ChatChannelMeta {
|
||||
|
||||
export function normalizeChatChannelId(raw?: string | null): ChatChannelId | null {
|
||||
const normalized = normalizeChannelKey(raw);
|
||||
if (!normalized) return null;
|
||||
if (!normalized) {
|
||||
return null;
|
||||
}
|
||||
const resolved = CHAT_CHANNEL_ALIASES[normalized] ?? normalized;
|
||||
return CHAT_CHANNEL_ORDER.includes(resolved) ? resolved : null;
|
||||
}
|
||||
@@ -142,14 +144,18 @@ export function normalizeChannelId(raw?: string | null): ChatChannelId | null {
|
||||
// monitors, web login, etc). The plugin registry must be initialized first.
|
||||
export function normalizeAnyChannelId(raw?: string | null): ChannelId | null {
|
||||
const key = normalizeChannelKey(raw);
|
||||
if (!key) return null;
|
||||
if (!key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const registry = requireActivePluginRegistry();
|
||||
const hit = registry.channels.find((entry) => {
|
||||
const id = String(entry.plugin.id ?? "")
|
||||
.trim()
|
||||
.toLowerCase();
|
||||
if (id && id === key) return true;
|
||||
if (id && id === key) {
|
||||
return true;
|
||||
}
|
||||
return (entry.plugin.meta.aliases ?? []).some((alias) => alias.trim().toLowerCase() === key);
|
||||
});
|
||||
return hit?.plugin.id ?? null;
|
||||
|
||||
Reference in New Issue
Block a user