Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Keep a settled card chip settled when its conversation has become private to someone else

AdityaUmale03964fd0f280
diff --git a/server/host/ask-cards.test.ts b/server/host/ask-cards.test.ts
index 9d84c2c4b0..84ee96d96c 100644
--- a/server/host/ask-cards.test.ts
+++ b/server/host/ask-cards.test.ts
@@ -436,6 +436,16 @@ describe("the chip in the conversation that handed the work on", () => {
expect(team.rows("inbox")).toEqual([]);
});
+ it("leaves a settled chip settled when its conversation has since become private to someone else", () => {
+ const privateThreads: string[] = [];
+ const team = world({ privateThreads });
+ team.cards.showWaitingOnCardChip("work", { kind: "sign-in", messageId: "c1", label: "example.com" }, asker);
+ team.cards.settleWaitingOnCardChip("work", "c1");
+ privateThreads.push("work");
+ team.cards.reopenWaitingOnCardChip("work", "c1");
+ expect(team.rows("inbox")[0]!.tool).toMatchObject({ name: "@Ledger no longer waits on you", ok: true });
+ });
+
it("leaves a card's chip out of the person's inbox, which has the card, and out of work nobody handed on", () => {
const team = world({ inboxThread: "inbox" });
team.cards.showWaitingOnCardChip("work", { kind: "password", messageId: "c1", label: "API key" }, asker);
diff --git a/server/host/ask-cards.ts b/server/host/ask-cards.ts
index a9a23b1e9d..821e3d3cee 100644
--- a/server/host/ask-cards.ts
+++ b/server/host/ask-cards.ts
@@ -147,7 +147,7 @@ export function createAskCards(deps: AskCardsDeps) {
/** The same card waits again (the person went back to its branch): its chip says so again, on the same line. */
function reopenWaitingOnCardChip(threadId: string, cardMessageId: string) {
const chip = waitingCardChips.get(`${threadId}:${cardMessageId}`);
- if (!chip?.settled) return;
+ if (!chip?.settled || deps.keptPrivate(threadId, chip.threadId)) return;
chip.settled = false;
const existing = store.messagesFor(chip.threadId).find((message) => message.id === chip.messageId);
if (!existing?.tool) return;