From 9f907320c33fcd0f5f177cd5d2a472acf168e69f Mon Sep 17 00:00:00 2001 From: Nimrod Gutman Date: Tue, 17 Feb 2026 11:16:36 +0200 Subject: [PATCH] Revert "fix: handle forum/topics in Telegram DM thread routing (#17980)" This reverts commit e20b87f1ba332e2b7838d05e38e3bd7d991f460d. --- src/telegram/bot/helpers.test.ts | 29 ----------------------------- src/telegram/bot/helpers.ts | 14 ++++++-------- 2 files changed, 6 insertions(+), 37 deletions(-) diff --git a/src/telegram/bot/helpers.test.ts b/src/telegram/bot/helpers.test.ts index f8842004fb..a03ad33443 100644 --- a/src/telegram/bot/helpers.test.ts +++ b/src/telegram/bot/helpers.test.ts @@ -5,7 +5,6 @@ import { expandTextLinks, normalizeForwardedContext, resolveTelegramForumThreadId, - resolveTelegramThreadSpec, } from "./helpers.js"; describe("resolveTelegramForumThreadId", () => { @@ -33,34 +32,6 @@ describe("resolveTelegramForumThreadId", () => { }); }); -describe("resolveTelegramThreadSpec", () => { - it("returns dm scope for plain DM (no forum, no thread id)", () => { - expect(resolveTelegramThreadSpec({ isGroup: false })).toEqual({ scope: "dm" }); - }); - - it("preserves thread id with dm scope when DM has thread id but is not a forum", () => { - expect( - resolveTelegramThreadSpec({ isGroup: false, isForum: false, messageThreadId: 42 }), - ).toEqual({ id: 42, scope: "dm" }); - }); - - it("returns forum scope when DM has isForum and thread id", () => { - expect( - resolveTelegramThreadSpec({ isGroup: false, isForum: true, messageThreadId: 99 }), - ).toEqual({ id: 99, scope: "forum" }); - }); - - it("falls back to dm scope when DM has isForum but no thread id", () => { - expect(resolveTelegramThreadSpec({ isGroup: false, isForum: true })).toEqual({ scope: "dm" }); - }); - - it("delegates to group path for groups", () => { - expect( - resolveTelegramThreadSpec({ isGroup: true, isForum: true, messageThreadId: 50 }), - ).toEqual({ id: 50, scope: "forum" }); - }); -}); - describe("buildTelegramThreadParams", () => { it("omits General topic thread id for message sends", () => { expect(buildTelegramThreadParams({ id: 1, scope: "forum" })).toBeUndefined(); diff --git a/src/telegram/bot/helpers.ts b/src/telegram/bot/helpers.ts index 7f842976d6..b6cf1783f0 100644 --- a/src/telegram/bot/helpers.ts +++ b/src/telegram/bot/helpers.ts @@ -101,15 +101,13 @@ export function resolveTelegramThreadSpec(params: { scope: params.isForum ? "forum" : "none", }; } - // DM with forum/topics enabled — treat like a forum, not a flat DM - if (params.isForum && params.messageThreadId != null) { - return { id: params.messageThreadId, scope: "forum" }; + if (params.messageThreadId == null) { + return { scope: "dm" }; } - // Preserve thread ID for non-forum DM threads (session routing, #8891) - if (params.messageThreadId != null) { - return { id: params.messageThreadId, scope: "dm" }; - } - return { scope: "dm" }; + return { + id: params.messageThreadId, + scope: "dm", + }; } /**