mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 05:54:43 +00:00
feishu extension: tighten reply target fallback semantics
This commit is contained in:
@@ -155,6 +155,26 @@ describe("feishuOutbound.sendText local-image auto-convert", () => {
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("falls back to threadId when replyToId is empty on sendText", async () => {
|
||||
await sendText({
|
||||
cfg: {} as any,
|
||||
to: "chat_1",
|
||||
text: "hello",
|
||||
replyToId: " ",
|
||||
threadId: "om_thread_2",
|
||||
accountId: "main",
|
||||
} as any);
|
||||
|
||||
expect(sendMessageFeishuMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
to: "chat_1",
|
||||
text: "hello",
|
||||
replyToMessageId: "om_thread_2",
|
||||
accountId: "main",
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("feishuOutbound.sendMedia renderMode", () => {
|
||||
@@ -216,5 +236,13 @@ describe("feishuOutbound.sendMedia renderMode", () => {
|
||||
accountId: "main",
|
||||
}),
|
||||
);
|
||||
expect(sendMessageFeishuMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
to: "chat_1",
|
||||
text: "caption",
|
||||
replyToMessageId: "om_thread_1",
|
||||
accountId: "main",
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -47,11 +47,14 @@ function resolveReplyToMessageId(params: {
|
||||
replyToId?: string | null;
|
||||
threadId?: string | number | null;
|
||||
}): string | undefined {
|
||||
const replyTarget = params.replyToId ?? params.threadId;
|
||||
if (replyTarget == null) {
|
||||
const replyToId = params.replyToId?.trim();
|
||||
if (replyToId) {
|
||||
return replyToId;
|
||||
}
|
||||
if (params.threadId == null) {
|
||||
return undefined;
|
||||
}
|
||||
const trimmed = String(replyTarget).trim();
|
||||
const trimmed = String(params.threadId).trim();
|
||||
return trimmed || undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user