mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
fix: preserve delivery thread fallback (#4911) (thanks @yevhen)
This commit is contained in:
@@ -88,6 +88,20 @@ describe("delivery context helpers", () => {
|
||||
accountId: undefined,
|
||||
threadId: 42,
|
||||
});
|
||||
|
||||
expect(
|
||||
deliveryContextFromSession({
|
||||
channel: "telegram",
|
||||
lastTo: " -1001 ",
|
||||
deliveryContext: { threadId: " 777 " },
|
||||
origin: { threadId: 42 },
|
||||
}),
|
||||
).toEqual({
|
||||
channel: "telegram",
|
||||
to: "-1001",
|
||||
accountId: undefined,
|
||||
threadId: "777",
|
||||
});
|
||||
});
|
||||
|
||||
it("normalizes delivery fields and mirrors them on session entries", () => {
|
||||
|
||||
@@ -98,7 +98,7 @@ export function deliveryContextFromSession(
|
||||
lastChannel: entry.lastChannel,
|
||||
lastTo: entry.lastTo,
|
||||
lastAccountId: entry.lastAccountId,
|
||||
lastThreadId: entry.lastThreadId ?? entry.origin?.threadId,
|
||||
lastThreadId: entry.lastThreadId ?? entry.deliveryContext?.threadId ?? entry.origin?.threadId,
|
||||
deliveryContext: entry.deliveryContext,
|
||||
};
|
||||
return normalizeSessionDeliveryFields(source).deliveryContext;
|
||||
|
||||
Reference in New Issue
Block a user