mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-10 16:51:13 +00:00
fix(regression): preserve feishu pairing account context
This commit is contained in:
@@ -144,6 +144,45 @@ describe("feishuPlugin.status.probeAccount", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("feishuPlugin.pairing.notifyApproval", () => {
|
||||
beforeEach(async () => {
|
||||
vi.resetModules();
|
||||
({ feishuPlugin } = await import("./channel.js"));
|
||||
sendMessageFeishuMock.mockReset();
|
||||
sendMessageFeishuMock.mockResolvedValue({ messageId: "pairing-msg", chatId: "ou_user" });
|
||||
});
|
||||
|
||||
it("preserves accountId when sending pairing approvals", async () => {
|
||||
const cfg = {
|
||||
channels: {
|
||||
feishu: {
|
||||
accounts: {
|
||||
work: {
|
||||
appId: "cli_work",
|
||||
appSecret: "secret_work",
|
||||
enabled: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} as OpenClawConfig;
|
||||
|
||||
await feishuPlugin.pairing?.notifyApproval?.({
|
||||
cfg,
|
||||
id: "ou_user",
|
||||
accountId: "work",
|
||||
});
|
||||
|
||||
expect(sendMessageFeishuMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
cfg,
|
||||
to: "ou_user",
|
||||
accountId: "work",
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("feishuPlugin actions", () => {
|
||||
const cfg = {
|
||||
channels: {
|
||||
|
||||
@@ -1161,12 +1161,13 @@ export const feishuPlugin: ChannelPlugin<ResolvedFeishuAccount, FeishuProbeResul
|
||||
idLabel: "feishuUserId",
|
||||
message: PAIRING_APPROVED_MESSAGE,
|
||||
normalizeAllowEntry: createPairingPrefixStripper(/^(feishu|user|open_id):/i),
|
||||
notify: async ({ cfg, id, message }) => {
|
||||
notify: async ({ cfg, id, message, accountId }) => {
|
||||
const { sendMessageFeishu } = await loadFeishuChannelRuntime();
|
||||
await sendMessageFeishu({
|
||||
cfg,
|
||||
to: id,
|
||||
text: message,
|
||||
accountId,
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user