Skip to content

Commit 8deb910

Browse files
authored
fix(feishu): preserve the accepted comment delivery identity (#128284)
1 parent e3e4612 commit 8deb910

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎extensions/feishu/src/outbound.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2280,6 +2280,7 @@ describe("feishuOutbound comment-thread routing", () => {
22802280
});
22812281

22822282
it("preserves comment-thread routing when deliverCommentThreadText falls back to add_comment", async () => {
2283+
const onDeliveryResult = vi.fn();
22832284
deliverCommentThreadTextMock.mockResolvedValueOnce({
22842285
delivery_mode: "add_comment",
22852286
comment_id: "comment_msg",
@@ -2291,13 +2292,15 @@ describe("feishuOutbound comment-thread routing", () => {
22912292
to: "comment:docx:doxcn123:7623358762119646411",
22922293
text: "whole-comment follow-up",
22932294
accountId: "main",
2295+
onDeliveryResult,
22942296
});
22952297

22962298
expect(commentThreadParams()?.file_token).toBe("doxcn123");
22972299
expect(commentThreadParams()?.file_type).toBe("docx");
22982300
expect(commentThreadParams()?.comment_id).toBe("7623358762119646411");
22992301
expect(commentThreadParams()?.content).toBe("whole-comment follow-up");
2300-
expectFeishuResult(result, "reply_from_add_comment");
2302+
expectFeishuResult(result, "comment_msg");
2303+
expect(onDeliveryResult.mock.calls[0]?.[0]?.messageId).toBe("comment_msg");
23012304
});
23022305

23032306
it("does not wait for ambient comment typing cleanup before sending comment-thread replies", async () => {

‎extensions/feishu/src/outbound.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,7 @@ async function sendCommentThreadReply(params: {
377377
});
378378
return {
379379
messageId:
380-
(typeof result.reply_id === "string" && result.reply_id) ||
381-
(typeof result.comment_id === "string" && result.comment_id) ||
382-
"",
380+
(result.delivery_mode === "reply_comment" ? result.reply_id : result.comment_id) ?? "",
383381
chatId: target.commentId,
384382
result,
385383
};

0 commit comments

Comments
 (0)