mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 15:30:21 +00:00
Fix Telegram DM last-route metadata leakage (#19491)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 16b025b3aa
Co-authored-by: guirguispierre <22091706+guirguispierre@users.noreply.github.com>
Co-authored-by: obviyus <22031114+obviyus@users.noreply.github.com>
Reviewed-by: @obviyus
This commit is contained in:
@@ -41,8 +41,9 @@ describe("buildTelegramMessageContext DM topic threadId in deliveryContext (#889
|
||||
expect(recordInboundSessionMock).toHaveBeenCalled();
|
||||
|
||||
// Check that updateLastRoute includes threadId
|
||||
const updateLastRoute = getUpdateLastRoute() as { threadId?: string } | undefined;
|
||||
const updateLastRoute = getUpdateLastRoute() as { threadId?: string; to?: string } | undefined;
|
||||
expect(updateLastRoute).toBeDefined();
|
||||
expect(updateLastRoute?.to).toBe("telegram:1234");
|
||||
expect(updateLastRoute?.threadId).toBe("42");
|
||||
});
|
||||
|
||||
@@ -57,8 +58,9 @@ describe("buildTelegramMessageContext DM topic threadId in deliveryContext (#889
|
||||
expect(recordInboundSessionMock).toHaveBeenCalled();
|
||||
|
||||
// Check that updateLastRoute does NOT include threadId
|
||||
const updateLastRoute = getUpdateLastRoute() as { threadId?: string } | undefined;
|
||||
const updateLastRoute = getUpdateLastRoute() as { threadId?: string; to?: string } | undefined;
|
||||
expect(updateLastRoute).toBeDefined();
|
||||
expect(updateLastRoute?.to).toBe("telegram:1234");
|
||||
expect(updateLastRoute?.threadId).toBeUndefined();
|
||||
});
|
||||
|
||||
|
||||
@@ -765,7 +765,7 @@ export const buildTelegramMessageContext = async ({
|
||||
? {
|
||||
sessionKey: route.mainSessionKey,
|
||||
channel: "telegram",
|
||||
to: String(chatId),
|
||||
to: `telegram:${chatId}`,
|
||||
accountId: route.accountId,
|
||||
// Preserve DM topic threadId for replies (fixes #8891)
|
||||
threadId: dmThreadId != null ? String(dmThreadId) : undefined,
|
||||
|
||||
Reference in New Issue
Block a user