fix: align reply threading refs

This commit is contained in:
Peter Steinberger
2026-01-12 23:41:00 +00:00
parent ca98f87b2f
commit bb9a9633a8
5 changed files with 189 additions and 38 deletions

View File

@@ -12,6 +12,7 @@ import {
resolveDiscordReplyTarget,
resolveDiscordShouldRequireMention,
resolveGroupDmAllow,
sanitizeDiscordThreadName,
shouldEmitDiscordReactionNotification,
} from "./monitor.js";
@@ -326,6 +327,21 @@ describe("discord reply target selection", () => {
});
});
describe("discord autoThread name sanitization", () => {
it("strips mentions and collapses whitespace", () => {
const name = sanitizeDiscordThreadName(
" <@123> <@&456> <#789> Help here ",
"msg-1",
);
expect(name).toBe("Help here");
});
it("falls back to thread + id when empty after cleaning", () => {
const name = sanitizeDiscordThreadName(" <@123>", "abc");
expect(name).toBe("Thread abc");
});
});
describe("discord reaction notification gating", () => {
it("defaults to own when mode is unset", () => {
expect(