mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 09:21:35 +07:00
fix(msteams): preserve timezone on memory upsert
This commit is contained in:
@@ -184,4 +184,27 @@ describe("msteams conversation store (memory)", () => {
|
||||
await expect(store.get("conv-a")).resolves.toBeNull();
|
||||
await expect(store.remove("missing")).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it("preserves existing timezone when upsert omits timezone, matching the fs store", async () => {
|
||||
const store = createMSTeamsConversationStoreMemory();
|
||||
|
||||
await store.upsert("conv-tz", {
|
||||
conversation: { id: "conv-tz" },
|
||||
channelId: "msteams",
|
||||
serviceUrl: "https://service.example.com",
|
||||
user: { id: "u1" },
|
||||
timezone: "Europe/London",
|
||||
});
|
||||
|
||||
await store.upsert("conv-tz", {
|
||||
conversation: { id: "conv-tz" },
|
||||
channelId: "msteams",
|
||||
serviceUrl: "https://service.example.com",
|
||||
user: { id: "u1" },
|
||||
});
|
||||
|
||||
await expect(store.get("conv-tz")).resolves.toMatchObject({
|
||||
timezone: "Europe/London",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -14,7 +14,11 @@ export function createMSTeamsConversationStoreMemory(
|
||||
|
||||
return {
|
||||
upsert: async (conversationId, reference) => {
|
||||
map.set(conversationId, reference);
|
||||
const existing = map.get(conversationId);
|
||||
map.set(conversationId, {
|
||||
...(existing?.timezone && !reference.timezone ? { timezone: existing.timezone } : {}),
|
||||
...reference,
|
||||
});
|
||||
},
|
||||
get: async (conversationId) => {
|
||||
return map.get(conversationId) ?? null;
|
||||
|
||||
Reference in New Issue
Block a user