mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 11:38:38 +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", () => {
|
describe("feishuOutbound.sendMedia renderMode", () => {
|
||||||
@@ -216,5 +236,13 @@ describe("feishuOutbound.sendMedia renderMode", () => {
|
|||||||
accountId: "main",
|
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;
|
replyToId?: string | null;
|
||||||
threadId?: string | number | null;
|
threadId?: string | number | null;
|
||||||
}): string | undefined {
|
}): string | undefined {
|
||||||
const replyTarget = params.replyToId ?? params.threadId;
|
const replyToId = params.replyToId?.trim();
|
||||||
if (replyTarget == null) {
|
if (replyToId) {
|
||||||
|
return replyToId;
|
||||||
|
}
|
||||||
|
if (params.threadId == null) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
const trimmed = String(replyTarget).trim();
|
const trimmed = String(params.threadId).trim();
|
||||||
return trimmed || undefined;
|
return trimmed || undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user