Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(inbox): render archived rows as read (MUL-4893) (#5549)
Naiyuan Qinga18cc65b359a
diff --git a/packages/views/inbox/components/inbox-list-item.test.tsx b/packages/views/inbox/components/inbox-list-item.test.tsxnew file mode 100644index 0000000000..f0b2938660--- /dev/null+++ b/packages/views/inbox/components/inbox-list-item.test.tsx@@ -0,0 +1,74 @@+import { render } from "@testing-library/react";+import { describe, expect, it, vi } from "vitest";+import type { InboxItem } from "@multica/core/types";+import { InboxListItem } from "./inbox-list-item";++vi.mock("../../issues/components", () => ({ StatusIcon: () => null }));+vi.mock("../../common/actor-avatar", () => ({ ActorAvatar: () => null }));+vi.mock("./inbox-detail-label", () => ({ InboxDetailLabel: () => null }));+vi.mock("../../i18n", () => ({ useT: () => ({ t: () => "label" }) }));++function item(overrides: Partial<InboxItem> = {}): InboxItem {+ return {+ id: "inbox-1",+ workspace_id: "workspace-1",+ recipient_type: "member",+ recipient_id: "member-1",+ actor_type: "agent",+ actor_id: "agent-1",+ type: "new_comment",+ severity: "info",+ issue_id: "issue-1",+ title: "Issue title",+ body: null,+ issue_status: null,+ read: false,+ archived: false,+ created_at: "2026-06-15T08:00:00Z",+ details: null,+ ...overrides,+ };+}++function renderRow(props: { item: InboxItem; view: "inbox" | "archived" }) {+ return render(+ <InboxListItem+ item={props.item}+ view={props.view}+ isSelected={false}+ onClick={vi.fn()}+ onAction={vi.fn()}+ />,+ );+}++const unreadDot = (container: HTMLElement) => container.querySelector(".bg-brand");+const title = (container: HTMLElement) => container.querySelector(".truncate");++describe("InboxListItem unread affordance", () => {+ it("marks an unread row in the main inbox", () => {+ const { container } = renderRow({ item: item({ read: false }), view: "inbox" });++ expect(unreadDot(container)).not.toBeNull();+ expect(title(container)?.className).toContain("font-medium");+ });++ it("leaves a read row unmarked in the main inbox", () => {+ const { container } = renderRow({ item: item({ read: true }), view: "inbox" });++ expect(unreadDot(container)).toBeNull();+ expect(title(container)?.className).not.toContain("font-medium");+ });++ it("renders an unread row as read in the archived view", () => {+ // Archiving preserves `read` so unarchiving can restore real unread state,+ // which left archived rows showing a dot no action in this view can clear.+ const { container } = renderRow({+ item: item({ read: false, archived: true }),+ view: "archived",+ });++ expect(unreadDot(container)).toBeNull();+ expect(title(container)?.className).not.toContain("font-medium");+ });+});diff --git a/packages/views/inbox/components/inbox-list-item.tsx b/packages/views/inbox/components/inbox-list-item.tsxindex 79b1ce444b..7a7b7e76c1 100644--- a/packages/views/inbox/components/inbox-list-item.tsx+++ b/packages/views/inbox/components/inbox-list-item.tsx@@ -45,6 +45,10 @@ export function InboxListItem({const timeAgo = useTimeAgo();const displayTitle = getInboxDisplayTitle(item);const isArchivedView = view === "archived";+ // Archiving deliberately leaves `read` untouched so unarchiving restores the+ // real unread state, so archived rows would otherwise keep an unread marker+ // the user cannot clear from this view. Suppress the affordance here only.+ const showUnread = item.read !== true && !isArchivedView;const ActionIcon = isArchivedView ? ArchiveRestore : Archive;const actionLabel = isArchivedView? t(($) => $.list.unarchive_tooltip)@@ -67,11 +71,11 @@ export function InboxListItem({<div className="min-w-0 flex-1"><div className="flex items-center justify-between gap-2"><div className="flex min-w-0 items-center gap-1.5">- {!item.read && (+ {showUnread && (<span className="h-1.5 w-1.5 shrink-0 rounded-full bg-brand" />)}<span- className={`truncate text-sm ${!item.read ? "font-medium" : "text-muted-foreground"}`}+ className={`truncate text-sm ${showUnread ? "font-medium" : "text-muted-foreground"}`}>{displayTitle}</span>@@ -102,10 +106,10 @@ export function InboxListItem({</div></div><div className="mt-0.5 flex items-center justify-between gap-2">- <p className={`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-xs ${item.read ? "text-muted-foreground/60" : "text-muted-foreground"}`}>+ <p className={`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap text-xs ${showUnread ? "text-muted-foreground" : "text-muted-foreground/60"}`}><InboxDetailLabel item={item} /></p>- <span className={`shrink-0 text-xs ${item.read ? "text-muted-foreground/60" : "text-muted-foreground"}`}>+ <span className={`shrink-0 text-xs ${showUnread ? "text-muted-foreground" : "text-muted-foreground/60"}`}>{timeAgo(item.created_at)}</span></div>