refactor(status-issues): share enabled/configured account gate

This commit is contained in:
Peter Steinberger
2026-02-16 01:03:02 +00:00
parent 4aaafe5322
commit e84b20a527
3 changed files with 27 additions and 10 deletions

View File

@@ -1,5 +1,10 @@
import type { ChannelAccountSnapshot, ChannelStatusIssue } from "../types.js";
import { appendMatchMetadata, asString, isRecord } from "./shared.js";
import {
appendMatchMetadata,
asString,
isRecord,
resolveEnabledConfiguredAccountId,
} from "./shared.js";
type TelegramAccountStatus = {
accountId?: unknown;
@@ -81,10 +86,8 @@ export function collectTelegramStatusIssues(
if (!account) {
continue;
}
const accountId = asString(account.accountId) ?? "default";
const enabled = account.enabled !== false;
const configured = account.configured === true;
if (!enabled || !configured) {
const accountId = resolveEnabledConfiguredAccountId(account);
if (!accountId) {
continue;
}