mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 02:00:40 +00:00
fix(feishu): restore private chat pairing replies in Lark/Feishu (openclaw#31403) thanks @stakeswky
Verified: - pnpm test -- extensions/feishu/src/bot.test.ts - pnpm build Co-authored-by: stakeswky <64798754+stakeswky@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -366,6 +366,41 @@ describe("handleFeishuMessage command authorization", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("replies pairing challenge to DM chat_id instead of user:sender id", async () => {
|
||||
const cfg: ClawdbotConfig = {
|
||||
channels: {
|
||||
feishu: {
|
||||
dmPolicy: "pairing",
|
||||
},
|
||||
},
|
||||
} as ClawdbotConfig;
|
||||
|
||||
const event: FeishuMessageEvent = {
|
||||
sender: {
|
||||
sender_id: {
|
||||
user_id: "u_mobile_only",
|
||||
},
|
||||
},
|
||||
message: {
|
||||
message_id: "msg-pairing-chat-reply",
|
||||
chat_id: "oc_dm_chat_1",
|
||||
chat_type: "p2p",
|
||||
message_type: "text",
|
||||
content: JSON.stringify({ text: "hello" }),
|
||||
},
|
||||
};
|
||||
|
||||
mockReadAllowFromStore.mockResolvedValue([]);
|
||||
mockUpsertPairingRequest.mockResolvedValue({ code: "ABCDEFGH", created: true });
|
||||
|
||||
await dispatchMessage({ cfg, event });
|
||||
|
||||
expect(mockSendMessageFeishu).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
to: "chat:oc_dm_chat_1",
|
||||
}),
|
||||
);
|
||||
});
|
||||
it("creates pairing request and drops unauthorized DMs in pairing mode", async () => {
|
||||
mockShouldComputeCommandAuthorized.mockReturnValue(false);
|
||||
mockReadAllowFromStore.mockResolvedValue([]);
|
||||
@@ -410,7 +445,7 @@ describe("handleFeishuMessage command authorization", () => {
|
||||
});
|
||||
expect(mockSendMessageFeishu).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
to: "user:ou-unapproved",
|
||||
to: "chat:oc-dm",
|
||||
accountId: "default",
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user