mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-02 07:50:22 +00:00
fix(regression): reject disabled channel auth stubs
This commit is contained in:
@@ -126,19 +126,13 @@ describe("channel-auth", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("auto-picks the single auth-capable channel even when raw channel config is omitted", async () => {
|
||||
mocks.loadConfig.mockReturnValue({ channels: {} });
|
||||
plugin.config.listAccountIds.mockReturnValue(["default"]);
|
||||
mocks.resolveAccount.mockReturnValue({ enabled: true });
|
||||
it("does not auto-pick enabled-only channel stubs when channel is omitted", async () => {
|
||||
mocks.loadConfig.mockReturnValue({ channels: { whatsapp: { enabled: false } } });
|
||||
|
||||
await runChannelLogin({}, runtime);
|
||||
|
||||
expect(mocks.normalizeChannelId).toHaveBeenCalledWith("whatsapp");
|
||||
expect(mocks.login).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
channelInput: "whatsapp",
|
||||
}),
|
||||
await expect(runChannelLogin({}, runtime)).rejects.toThrow(
|
||||
"Channel is required (no configured channels support login).",
|
||||
);
|
||||
expect(mocks.login).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("ignores configured channels that do not support login when channel is omitted", async () => {
|
||||
|
||||
@@ -29,6 +29,15 @@ function isConfiguredAuthPlugin(plugin: ChannelPlugin, cfg: OpenClawConfig): boo
|
||||
if (isBlockedObjectKey(key)) {
|
||||
return false;
|
||||
}
|
||||
const channelCfg = (cfg.channels as Record<string, unknown> | undefined)?.[key];
|
||||
if (
|
||||
channelCfg &&
|
||||
typeof channelCfg === "object" &&
|
||||
"enabled" in channelCfg &&
|
||||
(channelCfg as { enabled?: unknown }).enabled === false
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const accountId of plugin.config.listAccountIds(cfg)) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user