mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:01:37 +00:00
fix(reply): honour explicit [[reply_to_*]] tags when replyToMode is off (#16174)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 778fc2559a
Co-authored-by: aldoeliacim <17973757+aldoeliacim@users.noreply.github.com>
Co-authored-by: steipete <58493+steipete@users.noreply.github.com>
Reviewed-by: @steipete
This commit is contained in:
@@ -72,4 +72,17 @@ describe("applyReplyThreading auto-threading", () => {
|
||||
expect(result[0].replyToId).toBe("42");
|
||||
expect(result[0].replyToTag).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps explicit tags for Telegram when off mode is enabled", () => {
|
||||
const result = applyReplyThreading({
|
||||
payloads: [{ text: "[[reply_to_current]]A" }],
|
||||
replyToMode: "off",
|
||||
replyToChannel: "telegram",
|
||||
currentMessageId: "42",
|
||||
});
|
||||
|
||||
expect(result).toHaveLength(1);
|
||||
expect(result[0].replyToId).toBe("42");
|
||||
expect(result[0].replyToTag).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -54,9 +54,11 @@ export function createReplyToModeFilterForChannel(
|
||||
channel?: OriginatingChannelType,
|
||||
) {
|
||||
const provider = normalizeChannelId(channel);
|
||||
// Always honour explicit [[reply_to_*]] tags even when replyToMode is "off".
|
||||
// Per-channel opt-out is possible but the safe default is to allow them.
|
||||
const allowTagsWhenOff = provider
|
||||
? Boolean(getChannelDock(provider)?.threading?.allowTagsWhenOff)
|
||||
: false;
|
||||
? (getChannelDock(provider)?.threading?.allowTagsWhenOff ?? true)
|
||||
: true;
|
||||
return createReplyToModeFilter(mode, {
|
||||
allowTagsWhenOff,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user