mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
Revert "fix: handle forum/topics in Telegram DM thread routing (#17980)"
This reverts commit e20b87f1ba.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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",
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user