fix(discord): respect replyToMode in thread channel

This commit is contained in:
CHISEN Kaoru
2026-02-07 03:14:57 +00:00
committed by Shadow
parent d34138dfee
commit 4b3c9c9c5a
2 changed files with 15 additions and 4 deletions

View File

@@ -29,6 +29,9 @@ export function createReplyReferencePlanner(options: {
if (!allowReference) {
return undefined;
}
if (options.replyToMode === "off") {
return undefined;
}
if (existingId) {
hasReplied = true;
return existingId;
@@ -36,9 +39,6 @@ export function createReplyReferencePlanner(options: {
if (!startId) {
return undefined;
}
if (options.replyToMode === "off") {
return undefined;
}
if (options.replyToMode === "all") {
hasReplied = true;
return startId;

View File

@@ -74,7 +74,7 @@ describe("resolveDiscordReplyDeliveryPlan", () => {
expect(plan.replyReference.use()).toBeUndefined();
});
it("always uses existingId when inside a thread", () => {
it("respects replyToMode off even inside a thread", () => {
const plan = resolveDiscordReplyDeliveryPlan({
replyTarget: "channel:thread",
replyToMode: "off",
@@ -82,6 +82,17 @@ describe("resolveDiscordReplyDeliveryPlan", () => {
threadChannel: { id: "thread" },
createdThreadId: null,
});
expect(plan.replyReference.use()).toBeUndefined();
});
it("uses existingId when inside a thread with replyToMode all", () => {
const plan = resolveDiscordReplyDeliveryPlan({
replyTarget: "channel:thread",
replyToMode: "all",
messageId: "m1",
threadChannel: { id: "thread" },
createdThreadId: null,
});
expect(plan.replyReference.use()).toBe("m1");
});
});