Add the inbox mine tab and archive flow

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
dotta 2026-03-26 08:19:16 -05:00
parent b34fa3b273
commit 995f5b0b66
21 changed files with 12514 additions and 43 deletions

View file

@ -210,7 +210,7 @@ describe("inbox helpers", () => {
makeRun("run-latest", "timed_out", "2026-03-11T01:00:00.000Z"),
makeRun("run-other-agent", "failed", "2026-03-11T02:00:00.000Z", "agent-2"),
],
unreadIssues: [makeIssue("1", true)],
mineIssues: [makeIssue("1", true)],
dismissed: new Set<string>(),
});
@ -219,7 +219,7 @@ describe("inbox helpers", () => {
approvals: 1,
failedRuns: 2,
joinRequests: 1,
unreadTouchedIssues: 1,
mineIssues: 1,
alerts: 1,
});
});
@ -230,7 +230,7 @@ describe("inbox helpers", () => {
joinRequests: [],
dashboard,
heartbeatRuns: [makeRun("run-1", "failed", "2026-03-11T00:00:00.000Z")],
unreadIssues: [],
mineIssues: [],
dismissed: new Set<string>(["run:run-1", "alert:budget", "alert:agent-errors"]),
});
@ -239,7 +239,7 @@ describe("inbox helpers", () => {
approvals: 0,
failedRuns: 0,
joinRequests: 0,
unreadTouchedIssues: 0,
mineIssues: 0,
alerts: 0,
});
});
@ -262,6 +262,11 @@ describe("inbox helpers", () => {
),
];
expect(getApprovalsForTab(approvals, "mine", "all").map((approval) => approval.id)).toEqual([
"approval-revision",
"approval-approved",
"approval-pending",
]);
expect(getApprovalsForTab(approvals, "recent", "all").map((approval) => approval.id)).toEqual([
"approval-revision",
"approval-approved",
@ -338,10 +343,21 @@ describe("inbox helpers", () => {
});
it("can include sections on recent without forcing them to be unread", () => {
expect(
shouldShowInboxSection({
tab: "mine",
hasItems: true,
showOnMine: true,
showOnRecent: false,
showOnUnread: false,
showOnAll: false,
}),
).toBe(true);
expect(
shouldShowInboxSection({
tab: "recent",
hasItems: true,
showOnMine: false,
showOnRecent: true,
showOnUnread: false,
showOnAll: false,
@ -351,6 +367,7 @@ describe("inbox helpers", () => {
shouldShowInboxSection({
tab: "unread",
hasItems: true,
showOnMine: true,
showOnRecent: true,
showOnUnread: false,
showOnAll: false,
@ -371,16 +388,16 @@ describe("inbox helpers", () => {
expect(getUnreadTouchedIssues(recentIssues).map((issue) => issue.id)).toEqual(["1", "2", "3"]);
});
it("defaults the remembered inbox tab to recent and persists all", () => {
it("defaults the remembered inbox tab to mine and persists all", () => {
localStorage.clear();
expect(loadLastInboxTab()).toBe("recent");
expect(loadLastInboxTab()).toBe("mine");
saveLastInboxTab("all");
expect(loadLastInboxTab()).toBe("all");
});
it("maps legacy new-tab storage to recent", () => {
it("maps legacy new-tab storage to mine", () => {
localStorage.setItem("paperclip:inbox:last-tab", "new");
expect(loadLastInboxTab()).toBe("recent");
expect(loadLastInboxTab()).toBe("mine");
});
});