Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-6413: fix(issues): give the timeline's status glyph the custom status's identity (#7231)

Bohan Jiang4ba9b40d567e
diff --git a/packages/views/issues/components/issue-detail.test.tsx b/packages/views/issues/components/issue-detail.test.tsx
index a46b840a95..f2721b4fa9 100644
--- a/packages/views/issues/components/issue-detail.test.tsx
+++ b/packages/views/issues/components/issue-detail.test.tsx
@@ -2,7 +2,8 @@ import { forwardRef, useEffect, useRef, useState, useImperativeHandle } from "re
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
-import type { Issue, Label, TimelineEntry } from "@multica/core/types";
+import type { Issue, IssueStatusEntry, Label, TimelineEntry } from "@multica/core/types";
+import { issueStatusKeys } from "@multica/core/issue-statuses";
import { I18nProvider } from "@multica/core/i18n/react";
import { toast } from "sonner";
import { useResolvedExpandStore } from "@multica/core/issues/stores/resolved-expand-store";
@@ -615,6 +616,28 @@ function renderIssueDetail(issueId = "issue-1") {
);
}
+/**
+ * Renders with the workspace status catalog already in cache, so custom
+ * statuses resolve to their real name, category and color. Seeding the query
+ * (rather than stubbing the hook) keeps the shipped resolvers in the path; the
+ * generous staleTime on the catalog query means it is never refetched. Every
+ * other test runs without it — the cold-catalog case. (MUL-6243)
+ */
+function renderIssueDetailWithStatusCatalog(
+ entries: IssueStatusEntry[],
+ issueId = "issue-1",
+) {
+ const queryClient = createTestQueryClient();
+ queryClient.setQueryData(issueStatusKeys.list("ws-1"), { statuses: entries });
+ return render(
+ <I18nProvider locale="en" resources={TEST_RESOURCES}>
+ <QueryClientProvider client={queryClient}>
+ <IssueDetail issueId={issueId} />
+ </QueryClientProvider>
+ </I18nProvider>,
+ );
+}
+
function renderIssueDetailWithHighlight(
highlightCommentId: string,
issueId = "issue-1",
@@ -1315,6 +1338,94 @@ describe("IssueDetail (shared)", () => {
});
});
+ // -------------------------------------------------------------------------
+ // MUL-6413 — the activity glyph is per CATEGORY, so a move into a custom
+ // status drew the icon of the built-in it sits beside: "In Review → Awaiting
+ // Response" repainted identically and read as though nothing had moved.
+ // Colour is what carries a custom status's own identity.
+ // -------------------------------------------------------------------------
+
+ const IN_REVIEW_BUILT_IN: IssueStatusEntry = {
+ id: "in_review",
+ workspace_id: "ws-1",
+ key: "in_review",
+ name: "In Review",
+ description: "",
+ category: "in_review",
+ color: "#8b5cf6",
+ is_system: true,
+ position: 0,
+ archived_at: null,
+ created_at: "",
+ updated_at: "",
+ };
+
+ const AWAITING_RESPONSE: IssueStatusEntry = {
+ ...IN_REVIEW_BUILT_IN,
+ id: "awaiting_response",
+ key: "awaiting_response",
+ name: "Awaiting Response",
+ color: "#ff0000",
+ is_system: false,
+ position: 1,
+ };
+
+ function statusChangeIcon(to: string): SVGElement {
+ const row = screen.getByText(new RegExp(`to ${to}$`, "i")).closest("div")
+ ?.parentElement;
+ const icon = row?.querySelector("svg");
+ if (!icon) throw new Error(`no status glyph for the "${to}" activity row`);
+ return icon;
+ }
+
+ it("paints a status-change activity in the custom status's own colour", async () => {
+ mockApiObj.listTimeline.mockResolvedValue([
+ {
+ type: "activity",
+ id: "act-custom-status",
+ actor_type: "member",
+ actor_id: "user-1",
+ action: "status_changed",
+ details: { from: "in_review", to: "awaiting_response" },
+ created_at: "2026-01-18T00:00:00Z",
+ },
+ ] as TimelineEntry[]);
+
+ renderIssueDetailWithStatusCatalog([IN_REVIEW_BUILT_IN, AWAITING_RESPONSE]);
+
+ await waitFor(() => {
+ expect(
+ screen.getByText(/from In Review to Awaiting Response/i),
+ ).toBeInTheDocument();
+ });
+ expect(statusChangeIcon("Awaiting Response").style.color).toBe("rgb(255, 0, 0)");
+ });
+
+ it("leaves a built-in status-change activity on its semantic token colour", async () => {
+ // The catalog seeds a colour for the built-ins too, but those are theme
+ // tokens in the UI — painting the seeded hex would hard-code one theme.
+ mockApiObj.listTimeline.mockResolvedValue([
+ {
+ type: "activity",
+ id: "act-built-in-status",
+ actor_type: "member",
+ actor_id: "user-1",
+ action: "status_changed",
+ details: { from: "in_progress", to: "in_review" },
+ created_at: "2026-01-18T00:00:00Z",
+ },
+ ] as TimelineEntry[]);
+
+ renderIssueDetailWithStatusCatalog([IN_REVIEW_BUILT_IN, AWAITING_RESPONSE]);
+
+ await waitFor(() => {
+ expect(screen.getByText(/from In Progress to In Review/i)).toBeInTheDocument();
+ });
+ const icon = statusChangeIcon("In Review");
+ expect(icon.style.color).toBe("");
+ expect(icon.getAttribute("class")).toContain("text-success");
+ });
+
it("truncates the trailing activity block to the most recent 8 entries with a show-more toggle", async () => {
// 10 activities, all in the trailing block (no comment after them, so it's
// the trailing block by definition). Alternating action types so the
diff --git a/packages/views/issues/components/issue-detail.tsx b/packages/views/issues/components/issue-detail.tsx
index 3eca2af368..1ac7d80185 100644
--- a/packages/views/issues/components/issue-detail.tsx
+++ b/packages/views/issues/components/issue-detail.tsx
@@ -532,6 +532,7 @@ function ActivityBlock({
getActorName,
resolveStatusLabel,
resolveStatusCategory,
+ resolveStatusColor,
t,
timeAgo,
}: {
@@ -547,6 +548,8 @@ function ActivityBlock({
getActorName: (type: string, id: string) => string;
resolveStatusLabel: (statusKey: string) => string;
resolveStatusCategory: (statusKey: string) => IssueStatusCategory;
+ /** A custom status's own `#rrggbb`; null for built-ins and unknown keys. */
+ resolveStatusColor: (statusKey: string) => string | null;
t: ActivityT;
timeAgo: (dateStr: string) => string;
}) {
@@ -613,6 +616,7 @@ function ActivityBlock({
<StatusIcon
status={details.to as IssueStatus}
category={resolveStatusCategory(details.to ?? "")}
+ color={resolveStatusColor(details.to ?? "")}
className="h-4 w-4 shrink-0"
/>
);
@@ -1134,7 +1138,22 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr
const { data: allIssues = [] } = useQuery(issueListOptions(wsId));
const { getActorName } = useActorName();
const resolveStatusLabel = useStatusLabel(wsId);
- const { categoryOf: resolveStatusCategory } = useIssueStatuses(wsId);
+ const { categoryOf: resolveStatusCategory, entryOf: statusEntryOf } =
+ useIssueStatuses(wsId);
+ // The glyph set is per CATEGORY (MUL-6243), so a status-change entry for a
+ // custom status drew the same icon as the built-in it sits beside — an
+ // "In Review → Awaiting Response" line looked like nothing had moved. Colour
+ // is what carries a custom status's own identity, as the inbox row and the
+ // status-changed detail label already render it. Built-ins resolve to null so
+ // they keep their semantic token rather than the catalog's English seed hex.
+ const resolveStatusColor = useCallback(
+ (statusKey: string): string | null => {
+ const entry = statusEntryOf(statusKey);
+ if (!entry || entry.is_system === true) return null;
+ return entry.color;
+ },
+ [statusEntryOf],
+ );
// Description autosave is deliberately NOT gated (no explicit submit; the
// editor already strips `blob:` before serializing and binds ids on the
// later save). It still needs the failure toast, or a failed upload just
@@ -2665,6 +2684,7 @@ export function IssueDetail({ issueId, onDelete, onDone, defaultSidebarOpen = tr
getActorName={getActorName}
resolveStatusLabel={resolveStatusLabel}
resolveStatusCategory={resolveStatusCategory}
+ resolveStatusColor={resolveStatusColor}
t={t}
timeAgo={timeAgo}
/>