fix(doctor): avoid ack reaction migration without config (#1087)
Thanks @YuriNachos. Co-authored-by: Yuri Chukhlib <YuriNachos@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,9 @@ Docs: https://docs.clawd.bot
|
||||
- macOS: strip prerelease/build suffixes when parsing gateway semver patches. (#1110) — thanks @zerone0x.
|
||||
- macOS: keep CLI install pinned to the full build suffix. (#1111) — thanks @artuskg.
|
||||
|
||||
### Fixes
|
||||
- Doctor: avoid re-adding WhatsApp ack reaction config when only legacy auth files exist. (#1087) — thanks @YuriNachos.
|
||||
|
||||
## 2026.1.16-2
|
||||
|
||||
### Changes
|
||||
|
||||
@@ -57,7 +57,7 @@ describe("normalizeLegacyConfigValues", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("copies legacy ack reaction when whatsapp auth exists", () => {
|
||||
it("does not add whatsapp config when only auth exists (issue #900)", () => {
|
||||
const credsDir = path.join(tempOauthDir ?? "", "whatsapp", "default");
|
||||
writeCreds(credsDir);
|
||||
|
||||
@@ -65,14 +65,11 @@ describe("normalizeLegacyConfigValues", () => {
|
||||
messages: { ackReaction: "👀", ackReactionScope: "group-mentions" },
|
||||
});
|
||||
|
||||
expect(res.config.channels?.whatsapp?.ackReaction).toEqual({
|
||||
emoji: "👀",
|
||||
direct: false,
|
||||
group: "mentions",
|
||||
});
|
||||
expect(res.config.channels?.whatsapp).toBeUndefined();
|
||||
expect(res.changes).toEqual([]);
|
||||
});
|
||||
|
||||
it("copies legacy ack reaction when legacy auth exists", () => {
|
||||
it("does not add whatsapp config when only legacy auth exists (issue #900)", () => {
|
||||
const credsPath = path.join(tempOauthDir ?? "", "creds.json");
|
||||
fs.writeFileSync(credsPath, JSON.stringify({ me: {} }));
|
||||
|
||||
@@ -80,14 +77,11 @@ describe("normalizeLegacyConfigValues", () => {
|
||||
messages: { ackReaction: "👀", ackReactionScope: "group-mentions" },
|
||||
});
|
||||
|
||||
expect(res.config.channels?.whatsapp?.ackReaction).toEqual({
|
||||
emoji: "👀",
|
||||
direct: false,
|
||||
group: "mentions",
|
||||
});
|
||||
expect(res.config.channels?.whatsapp).toBeUndefined();
|
||||
expect(res.changes).toEqual([]);
|
||||
});
|
||||
|
||||
it("copies legacy ack reaction when non-default auth exists", () => {
|
||||
it("does not add whatsapp config when only non-default auth exists (issue #900)", () => {
|
||||
const credsDir = path.join(tempOauthDir ?? "", "whatsapp", "work");
|
||||
writeCreds(credsDir);
|
||||
|
||||
@@ -95,11 +89,8 @@ describe("normalizeLegacyConfigValues", () => {
|
||||
messages: { ackReaction: "👀", ackReactionScope: "group-mentions" },
|
||||
});
|
||||
|
||||
expect(res.config.channels?.whatsapp?.ackReaction).toEqual({
|
||||
emoji: "👀",
|
||||
direct: false,
|
||||
group: "mentions",
|
||||
});
|
||||
expect(res.config.channels?.whatsapp).toBeUndefined();
|
||||
expect(res.changes).toEqual([]);
|
||||
});
|
||||
|
||||
it("copies legacy ack reaction when authDir override exists", () => {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
import { hasAnyWhatsAppAuth } from "../web/accounts.js";
|
||||
|
||||
export function normalizeLegacyConfigValues(cfg: ClawdbotConfig): {
|
||||
config: ClawdbotConfig;
|
||||
changes: string[];
|
||||
@@ -10,8 +8,7 @@ export function normalizeLegacyConfigValues(cfg: ClawdbotConfig): {
|
||||
|
||||
const legacyAckReaction = cfg.messages?.ackReaction?.trim();
|
||||
const hasWhatsAppConfig = cfg.channels?.whatsapp !== undefined;
|
||||
const hasWhatsAppAuth = hasAnyWhatsAppAuth(cfg);
|
||||
if (legacyAckReaction && (hasWhatsAppConfig || hasWhatsAppAuth)) {
|
||||
if (legacyAckReaction && hasWhatsAppConfig) {
|
||||
const hasWhatsAppAck = cfg.channels?.whatsapp?.ackReaction !== undefined;
|
||||
if (!hasWhatsAppAck) {
|
||||
const legacyScope = cfg.messages?.ackReactionScope ?? "group-mentions";
|
||||
|
||||
Reference in New Issue
Block a user