refactor: read accounts from cfg.channels.matrix.accounts directly for clarity

This commit is contained in:
Monty Taylor
2026-02-09 08:28:23 -07:00
committed by Peter Steinberger
parent bf4e348440
commit 1a72902991

View File

@@ -21,13 +21,14 @@ export function resolveMatrixConfigForAccount(
): MatrixResolvedConfig { ): MatrixResolvedConfig {
const normalizedAccountId = normalizeAccountId(accountId); const normalizedAccountId = normalizeAccountId(accountId);
const matrixBase = cfg.channels?.matrix ?? {}; const matrixBase = cfg.channels?.matrix ?? {};
const accounts = cfg.channels?.matrix?.accounts;
// Try to get account-specific config first (direct lookup, then case-insensitive fallback) // Try to get account-specific config first (direct lookup, then case-insensitive fallback)
let accountConfig = matrixBase.accounts?.[normalizedAccountId]; let accountConfig = accounts?.[normalizedAccountId];
if (!accountConfig && matrixBase.accounts) { if (!accountConfig && accounts) {
for (const key of Object.keys(matrixBase.accounts)) { for (const key of Object.keys(accounts)) {
if (normalizeAccountId(key) === normalizedAccountId) { if (normalizeAccountId(key) === normalizedAccountId) {
accountConfig = matrixBase.accounts[key]; accountConfig = accounts[key];
break; break;
} }
} }