
























@@ -1098,59 +1098,63 @@ vi.mock("./doctor/shared/preview-warnings.js", () => {
10981098];
10991099}
110011001101-return {
1102-collectDoctorPreviewWarnings: vi.fn(
1103-async ({
1104- cfg,
1105-}: {
1106-cfg: {
1107-channels?: Record<string, unknown>;
1108-plugins?: { enabled?: boolean; entries?: Record<string, { enabled?: boolean }> };
1109-};
1110-doctorFixCommand: string;
1111-}) => {
1112-const warnings: string[] = [];
1113-const telegram = asRecord(cfg.channels?.telegram);
1114-if (telegram) {
1115-const telegramBlocked =
1116-cfg.plugins?.enabled === false || cfg.plugins?.entries?.telegram?.enabled === false;
1117-if (telegramBlocked) {
1118-warnings.push(
1119-cfg.plugins?.enabled === false
1120- ? "- channels.telegram: channel is configured, but plugins.enabled=false blocks channel plugins globally. Fix plugin enablement before relying on setup guidance for this channel."
1121- : '- channels.telegram: channel is configured, but plugin "telegram" is disabled by plugins.entries.telegram.enabled=false. Fix plugin enablement before relying on setup guidance for this channel.',
1122-);
1123-} else {
1101+async function collectWarnings({
1102+ cfg,
1103+}: {
1104+cfg: {
1105+channels?: Record<string, unknown>;
1106+plugins?: { enabled?: boolean; entries?: Record<string, { enabled?: boolean }> };
1107+};
1108+doctorFixCommand: string;
1109+}): Promise<string[]> {
1110+const warnings: string[] = [];
1111+const telegram = asRecord(cfg.channels?.telegram);
1112+if (telegram) {
1113+const telegramBlocked =
1114+cfg.plugins?.enabled === false || cfg.plugins?.entries?.telegram?.enabled === false;
1115+if (telegramBlocked) {
1116+warnings.push(
1117+cfg.plugins?.enabled === false
1118+ ? "- channels.telegram: channel is configured, but plugins.enabled=false blocks channel plugins globally. Fix plugin enablement before relying on setup guidance for this channel."
1119+ : '- channels.telegram: channel is configured, but plugin "telegram" is disabled by plugins.entries.telegram.enabled=false. Fix plugin enablement before relying on setup guidance for this channel.',
1120+);
1121+} else {
1122+warnings.push(
1123+ ...telegramFirstTimeWarnings({
1124+account: telegram,
1125+prefix: "channels.telegram",
1126+}),
1127+);
1128+const accounts = asRecord(telegram.accounts);
1129+for (const [accountId, accountRaw] of Object.entries(accounts ?? {})) {
1130+const account = asRecord(accountRaw);
1131+if (account) {
11241132warnings.push(
11251133 ...telegramFirstTimeWarnings({
1126-account: telegram,
1127-prefix: "channels.telegram",
1134+ account,
1135+parent: telegram,
1136+prefix: `channels.telegram.accounts.${accountId}`,
11281137}),
11291138);
1130-const accounts = asRecord(telegram.accounts);
1131-for (const [accountId, accountRaw] of Object.entries(accounts ?? {})) {
1132-const account = asRecord(accountRaw);
1133-if (account) {
1134-warnings.push(
1135- ...telegramFirstTimeWarnings({
1136- account,
1137-parent: telegram,
1138-prefix: `channels.telegram.accounts.${accountId}`,
1139-}),
1140-);
1141-}
1142-}
11431139}
11441140}
1145-const imessage = asRecord(cfg.channels?.imessage);
1146-if (imessage?.groupPolicy === "allowlist" && !hasStringEntries(imessage.groupAllowFrom)) {
1147-warnings.push(
1148-'- channels.imessage.groupPolicy is "allowlist" but groupAllowFrom is empty — this channel does not fall back to allowFrom, so all group messages will be silently dropped.',
1149-);
1150-}
1151-return warnings;
1152-},
1153-),
1141+}
1142+}
1143+const imessage = asRecord(cfg.channels?.imessage);
1144+if (imessage?.groupPolicy === "allowlist" && !hasStringEntries(imessage.groupAllowFrom)) {
1145+warnings.push(
1146+'- channels.imessage.groupPolicy is "allowlist" but groupAllowFrom is empty — this channel does not fall back to allowFrom, so all group messages will be silently dropped.',
1147+);
1148+}
1149+return warnings;
1150+}
1151+1152+return {
1153+collectDoctorPreviewNotes: vi.fn(async (params) => ({
1154+infoNotes: [],
1155+warningNotes: await collectWarnings(params),
1156+})),
1157+collectDoctorPreviewWarnings: vi.fn(collectWarnings),
11541158};
11551159});
11561160此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。