Merge 20e0a535fb into 09be5d45d5
This commit is contained in:
commit
4101a88833
@ -74,7 +74,7 @@ describe("resolveDiscordReplyDeliveryPlan", () => {
|
||||
expect(plan.replyReference.use()).toBeUndefined();
|
||||
});
|
||||
|
||||
it("always uses existingId when inside a thread", () => {
|
||||
it("respects replyToMode off when 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 message reference when inside a thread with replyToMode first", () => {
|
||||
const plan = resolveDiscordReplyDeliveryPlan({
|
||||
replyTarget: "channel:thread",
|
||||
replyToMode: "first",
|
||||
messageId: "m1",
|
||||
threadChannel: { id: "thread" },
|
||||
createdThreadId: null,
|
||||
});
|
||||
expect(plan.replyReference.use()).toBe("m1");
|
||||
});
|
||||
});
|
||||
|
||||
@ -304,9 +304,14 @@ export function resolveDiscordReplyDeliveryPlan(params: {
|
||||
replyTarget = deliverTarget;
|
||||
}
|
||||
const allowReference = deliverTarget === originalReplyTarget;
|
||||
const effectiveReplyToMode = allowReference ? params.replyToMode : "off";
|
||||
// Don't pass existingId when replyToMode is "off" - this prevents
|
||||
// unwanted reply references in threads when the user has disabled them
|
||||
const existingId =
|
||||
params.threadChannel && effectiveReplyToMode !== "off" ? params.messageId : undefined;
|
||||
const replyReference = createReplyReferencePlanner({
|
||||
replyToMode: allowReference ? params.replyToMode : "off",
|
||||
existingId: params.threadChannel ? params.messageId : undefined,
|
||||
replyToMode: effectiveReplyToMode,
|
||||
existingId,
|
||||
startId: params.messageId,
|
||||
allowReference,
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user