Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Fix email inbox classification for payload-only sources (#1383)

Regan Bell9338c017bc2c
diff --git a/plugins/web-ui/src/inbox.ts b/plugins/web-ui/src/inbox.ts
index 6760bd68d..1d7f7b726 100644
--- a/plugins/web-ui/src/inbox.ts
+++ b/plugins/web-ui/src/inbox.ts
@@ -320,7 +320,7 @@ function resolvedStatus(entry: LedgerItem): InboxItem["status"] {
export function toInboxItem(entry: LedgerItem): InboxItem {
const payload = entry.sourcePayload;
- const source: InboxSource = entry.source === "gmail" ? "gmail" : "slack";
+ const source: InboxSource = (entry.source ?? payload.source) === "gmail" ? "gmail" : "slack";
const draft = draftOf(entry);
const resolved = resolvedStatus(entry);
const reactions = Array.isArray(payload.reactions) ? (payload.reactions as string[]) : undefined;
diff --git a/plugins/web-ui/test/inbox-context.test.ts b/plugins/web-ui/test/inbox-context.test.ts
index 777a68f9c..989a78c71 100644
--- a/plugins/web-ui/test/inbox-context.test.ts
+++ b/plugins/web-ui/test/inbox-context.test.ts
@@ -21,7 +21,14 @@ test("conversation details include the waiting message after prior context with
const { contextTpl, toInboxItem } = await vite.ssrLoadModule("/src/inbox.ts");
const { render } = await vite.ssrLoadModule("lit");
const host = dom.window.document.getElementById("main")!;
- for (const source of ["slack", "gmail"]) {
+ for (const [source, payloadSource] of [
+ ["slack", undefined],
+ ["gmail", undefined],
+ [undefined, "slack"],
+ [undefined, "gmail"],
+ ["slack", "gmail"],
+ ["gmail", "slack"],
+ ]) {
for (const context of [
undefined,
[],
@@ -34,6 +41,7 @@ test("conversation details include the waiting message after prior context with
state: "held",
source,
sourcePayload: {
+ source: payloadSource,
title: "Conversation",
from: "Sam",
snippet: "Latest waiting message",
@@ -44,6 +52,7 @@ test("conversation details include the waiting message after prior context with
updatedAt: 3000,
thread: [],
});
+ assert.equal(item.source, source ?? payloadSource);
render(contextTpl(item), host);
assert.deepEqual(
[...host.querySelectorAll(".inbox-context-text")].map((el) => el.textContent?.trim()),