Skip to content

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

Go

MUL-6669 feat(inbox): add From and unread-only filters (#7537)

Bohan Jiang6961b6091aa4
diff --git a/packages/core/inbox/filter-store.test.ts b/packages/core/inbox/filter-store.test.ts
index 7e0b45ba27..3128074a54 100644
--- a/packages/core/inbox/filter-store.test.ts
+++ b/packages/core/inbox/filter-store.test.ts
@@ -5,6 +5,7 @@ import type { InboxItem } from "../types";
import {
EMPTY_INBOX_FILTERS,
filterInboxItems,
+ inboxActorKey,
inboxFiltersForPrioritySupport,
inboxFilterCount,
inboxPriorityFilterSupport,
@@ -15,6 +16,7 @@ function item(
id: string,
issueStatus: InboxItem["issue_status"],
issuePriority: InboxItem["issue_priority"],
+ overrides: Partial<InboxItem> = {},
): InboxItem {
return {
id,
@@ -34,6 +36,7 @@ function item(
archived: false,
created_at: "2026-08-24T00:00:00Z",
details: null,
+ ...overrides,
};
}
@@ -56,6 +59,7 @@ describe("filterInboxItems", () => {
it("uses OR within a dimension and AND between dimensions", () => {
expect(
filterInboxItems(ITEMS, {
+ ...EMPTY_INBOX_FILTERS,
statuses: ["todo", "done"],
priorities: ["high"],
}).map((candidate) => candidate.id),
@@ -64,27 +68,110 @@ describe("filterInboxItems", () => {
it("excludes notifications without an issue when an issue filter is active", () => {
expect(
- filterInboxItems(ITEMS, { statuses: [], priorities: ["high"] }).map(
- (candidate) => candidate.id,
- ),
+ filterInboxItems(ITEMS, {
+ ...EMPTY_INBOX_FILTERS,
+ priorities: ["high"],
+ }).map((candidate) => candidate.id),
).toEqual(["todo-high", "done-high"]);
});
it("does not apply a priority condition until the projection is supported", () => {
- const filters = { statuses: ["todo"], priorities: ["high"] } as const;
+ const filters = {
+ ...EMPTY_INBOX_FILTERS,
+ statuses: ["todo"],
+ priorities: ["high"],
+ actors: ["member:alice"],
+ unreadOnly: true,
+ } as const;
+ // Only the unsupported dimension is dropped — a backend that cannot
+ // project priority still has nothing to say about who sent a
+ // notification or whether it was read.
expect(inboxFiltersForPrioritySupport(filters, "unknown")).toEqual({
- statuses: ["todo"],
+ ...filters,
priorities: [],
});
expect(inboxFiltersForPrioritySupport(filters, "unsupported")).toEqual({
- statuses: ["todo"],
+ ...filters,
priorities: [],
});
expect(inboxFiltersForPrioritySupport(filters, "supported")).toBe(filters);
});
});
+describe("actor filtering", () => {
+ const alice = { actor_type: "member" as const, actor_id: "alice" };
+ const bob = { actor_type: "agent" as const, actor_id: "bob" };
+
+ it("keys members and agents on their id and collapses system into one bucket", () => {
+ expect(inboxActorKey(item("a", "todo", "high", alice))).toBe("member:alice");
+ expect(inboxActorKey(item("b", "todo", "high", bob))).toBe("agent:bob");
+ expect(
+ inboxActorKey(
+ item("c", "todo", "high", { actor_type: "system", actor_id: null }),
+ ),
+ ).toBe("system");
+ expect(inboxActorKey(item("d", "todo", "high"))).toBeNull();
+ });
+
+ it("matches the rendered row's actor, not one buried in its group", () => {
+ // Alice commented, then Bob changed the status. Deduplication keeps Bob's
+ // row, and that row shows Bob — so filtering by Alice must not return it,
+ // or the list would answer "Alice" with Bob's avatar and Bob's wording.
+ const surviving = item("newest", "todo", "high", {
+ issue_id: "issue-1",
+ ...bob,
+ });
+
+ expect(
+ filterInboxItems([surviving], {
+ ...EMPTY_INBOX_FILTERS,
+ actors: ["member:alice"],
+ }),
+ ).toEqual([]);
+ expect(
+ filterInboxItems([surviving], {
+ ...EMPTY_INBOX_FILTERS,
+ actors: ["agent:bob"],
+ }).map((candidate) => candidate.id),
+ ).toEqual(["newest"]);
+ });
+
+ it("excludes a row that carries no attribution", () => {
+ expect(
+ filterInboxItems([item("unattributed", "todo", "high")], {
+ ...EMPTY_INBOX_FILTERS,
+ actors: ["member:alice"],
+ }),
+ ).toEqual([]);
+ });
+});
+
+describe("unread filtering", () => {
+ it("keeps unread rows and counts as one active filter", () => {
+ const rows = [
+ item("unread", "todo", "high"),
+ item("read", "todo", "high", { read: true }),
+ ];
+ const filters = { ...EMPTY_INBOX_FILTERS, unreadOnly: true };
+
+ expect(
+ filterInboxItems(rows, filters).map((candidate) => candidate.id),
+ ).toEqual(["unread"]);
+ expect(inboxFilterCount(filters)).toBe(1);
+ });
+
+ it("keeps notifications without an issue, unlike the issue dimensions", () => {
+ // The issue-less rows are the quick-create failures — the ones that most
+ // need to stay reachable while screening for what is unhandled.
+ const rows = [item("no-issue", null, null)];
+
+ expect(
+ filterInboxItems(rows, { ...EMPTY_INBOX_FILTERS, unreadOnly: true }),
+ ).toEqual(rows);
+ });
+});
+
describe("inboxPriorityFilterSupport", () => {
it("distinguishes an omitted legacy projection from a supported null", () => {
expect(inboxPriorityFilterSupport([])).toBe("unknown");
@@ -107,6 +194,9 @@ describe("useInboxFilterStore", () => {
"ws-1": { statuses: ["todo"], priorities: [] },
"ws-2": { statuses: [], priorities: ["urgent"] },
});
+ expect(
+ useInboxFilterStore.getState().filtersByWorkspace["ws-1"]?.unreadOnly,
+ ).toBe(false);
expect(
inboxFilterCount(useInboxFilterStore.getState().filtersByWorkspace["ws-1"]!),
).toBe(1);
@@ -124,8 +214,45 @@ describe("useInboxFilterStore", () => {
useInboxFilterStore.getState().clearPriorityFilters("ws-1");
expect(useInboxFilterStore.getState().filtersByWorkspace["ws-1"]).toEqual({
+ ...EMPTY_INBOX_FILTERS,
statuses: ["todo"],
- priorities: [],
});
});
+
+ it("keeps an actor or unread selection alive when priority is dropped", () => {
+ const store = useInboxFilterStore.getState();
+ store.toggleActorFilter("ws-1", "member:alice");
+ store.toggleUnreadOnly("ws-1");
+ store.togglePriorityFilter("ws-1", "high");
+
+ useInboxFilterStore.getState().clearPriorityFilters("ws-1");
+
+ expect(useInboxFilterStore.getState().filtersByWorkspace["ws-1"]).toEqual({
+ ...EMPTY_INBOX_FILTERS,
+ actors: ["member:alice"],
+ unreadOnly: true,
+ });
+ });
+
+ it("drops the workspace entry when clearing priority leaves nothing", () => {
+ useInboxFilterStore.getState().togglePriorityFilter("ws-1", "high");
+
+ useInboxFilterStore.getState().clearPriorityFilters("ws-1");
+
+ expect(
+ useInboxFilterStore.getState().filtersByWorkspace["ws-1"],
+ ).toBeUndefined();
+ });
+
+ it("toggles the unread dimension off again", () => {
+ useInboxFilterStore.getState().toggleUnreadOnly("ws-1");
+ expect(
+ useInboxFilterStore.getState().filtersByWorkspace["ws-1"]?.unreadOnly,
+ ).toBe(true);
+
+ useInboxFilterStore.getState().toggleUnreadOnly("ws-1");
+ expect(
+ useInboxFilterStore.getState().filtersByWorkspace["ws-1"]?.unreadOnly,
+ ).toBe(false);
+ });
});
diff --git a/packages/core/inbox/filter-store.ts b/packages/core/inbox/filter-store.ts
index 26d6114144..4e3ed6e77e 100644
--- a/packages/core/inbox/filter-store.ts
+++ b/packages/core/inbox/filter-store.ts
@@ -4,6 +4,33 @@ import type { InboxItem, IssuePriority, IssueStatus } from "../types";
export interface InboxFilters {
readonly statuses: readonly IssueStatus[];
readonly priorities: readonly IssuePriority[];
+ /** Actor keys — see `inboxActorKey`. */
+ readonly actors: readonly string[];
+ readonly unreadOnly: boolean;
+}
+
+/**
+ * Stable identity for "who this notification came from", used as the value of
+ * the `actors` dimension.
+ *
+ * Members and agents key on their id. `system` has no id — the backend writes
+ * an invalid UUID that serializes to null — so it keys on the type alone and
+ * every system notification collapses into one bucket. Returns null when the
+ * row carries no usable attribution; such a row can never match an actor
+ * selection, exactly as a row without an issue can never match a status one.
+ */
+export function inboxActorKey(item: InboxItem): string | null {
+ const type = item.actor_type;
+ if (!type) return null;
+ if (type === "system") return "system";
+ return item.actor_id ? `${type}:${item.actor_id}` : null;
+}
+
+/** Inverse of `inboxActorKey`, for resolving a selection back to a directory. */
+export function inboxActorKeyParts(key: string): { type: string; id: string } {
+ const separator = key.indexOf(":");
+ if (separator === -1) return { type: key, id: "" };
+ return { type: key.slice(0, separator), id: key.slice(separator + 1) };
}
export type InboxPriorityFilterSupport =
@@ -14,12 +41,21 @@ export type InboxPriorityFilterSupport =
export const EMPTY_INBOX_FILTERS: InboxFilters = Object.freeze({
statuses: Object.freeze([]),
priorities: Object.freeze([]),
+ actors: Object.freeze([]),
+ unreadOnly: false,
});
+/** True when nothing is selected in any dimension. */
+export function isEmptyInboxFilters(filters: InboxFilters): boolean {
+ return inboxFilterCount(filters) === 0;
+}
+
interface InboxFilterState {
filtersByWorkspace: Record<string, InboxFilters>;
toggleStatusFilter: (wsId: string, status: IssueStatus) => void;
togglePriorityFilter: (wsId: string, priority: IssuePriority) => void;
+ toggleActorFilter: (wsId: string, actor: string) => void;
+ toggleUnreadOnly: (wsId: string) => void;
clearPriorityFilters: (wsId: string) => void;
clearFilters: (wsId: string) => void;
}
@@ -58,20 +94,41 @@ export const useInboxFilterStore = create<InboxFilterState>()((set) => ({
},
};
}),
+ toggleActorFilter: (wsId, actor) =>
+ set((state) => {
+ const current = state.filtersByWorkspace[wsId] ?? EMPTY_INBOX_FILTERS;
+ return {
+ filtersByWorkspace: {
+ ...state.filtersByWorkspace,
+ [wsId]: { ...current, actors: toggleValue(current.actors, actor) },
+ },
+ };
+ }),
+ toggleUnreadOnly: (wsId) =>
+ set((state) => {
+ const current = state.filtersByWorkspace[wsId] ?? EMPTY_INBOX_FILTERS;
+ return {
+ filtersByWorkspace: {
+ ...state.filtersByWorkspace,
+ [wsId]: { ...current, unreadOnly: !current.unreadOnly },
+ },
+ };
+ }),
clearPriorityFilters: (wsId) =>
set((state) => {
const current = state.filtersByWorkspace[wsId];
if (!current || current.priorities.length === 0) return state;
- if (current.statuses.length === 0) {
+ const next = { ...current, priorities: [] };
+ // Emptiness is asked of every dimension, not just statuses: dropping the
+ // entry while an actor or unread selection survived in it would clear a
+ // filter the user set and the backend never had a say in.
+ if (isEmptyInboxFilters(next)) {
const { [wsId]: _removed, ...filtersByWorkspace } =
state.filtersByWorkspace;
return { filtersByWorkspace };
}
return {
- filtersByWorkspace: {
- ...state.filtersByWorkspace,
- [wsId]: { ...current, priorities: [] },
- },
+ filtersByWorkspace: { ...state.filtersByWorkspace, [wsId]: next },
};
}),
clearFilters: (wsId) =>
@@ -117,29 +174,52 @@ export function inboxFiltersForPrioritySupport(
if (support === "supported" || filters.priorities.length === 0) {
return filters;
}
- return { statuses: filters.statuses, priorities: [] };
+ return { ...filters, priorities: [] };
}
-/** OR within a dimension, AND between status and priority dimensions. */
+/**
+ * OR within a dimension, AND between dimensions.
+ *
+ * Every dimension is read off the row the list actually renders. For status
+ * and priority that is free — they are properties of the issue, identical on
+ * every notification in the group. For the actor it is a deliberate choice:
+ * deduplication keeps only a group's newest notification, and that row shows
+ * ITS actor's avatar and name. Matching an actor buried in an older row of
+ * the same group would answer a different question ("issues Alice has ever
+ * touched") than the one the row then displays, so selecting Alice would fill
+ * the list with Bob. What you filter by is what you see.
+ *
+ * `unreadOnly` likewise reads the rendered row's `read`, which is what the
+ * unread badge counts (`useInboxUnreadCount`) — so "only unread" and the
+ * number next to Inbox can never disagree.
+ */
export function filterInboxItems(
items: InboxItem[],
filters: InboxFilters,
): InboxItem[] {
- if (filters.statuses.length === 0 && filters.priorities.length === 0) {
- return items;
- }
+ if (isEmptyInboxFilters(filters)) return items;
const statuses = new Set(filters.statuses);
const priorities = new Set(filters.priorities);
- return items.filter(
- (item) =>
+ const actors = new Set(filters.actors);
+ return items.filter((item) => {
+ const actor = inboxActorKey(item);
+ return (
(statuses.size === 0 ||
(item.issue_status != null && statuses.has(item.issue_status))) &&
(priorities.size === 0 ||
- (item.issue_priority != null && priorities.has(item.issue_priority))),
- );
+ (item.issue_priority != null && priorities.has(item.issue_priority))) &&
+ (actors.size === 0 || (actor != null && actors.has(actor))) &&
+ (!filters.unreadOnly || item.read !== true)
+ );
+ });
}
export function inboxFilterCount(filters: InboxFilters): number {
- return filters.statuses.length + filters.priorities.length;
+ return (
+ filters.statuses.length +
+ filters.priorities.length +
+ filters.actors.length +
+ (filters.unreadOnly ? 1 : 0)
+ );
}
diff --git a/packages/views/inbox/components/inbox-filter-menu.test.tsx b/packages/views/inbox/components/inbox-filter-menu.test.tsx
index e044ce434e..ca09cd4c4b 100644
--- a/packages/views/inbox/components/inbox-filter-menu.test.tsx
+++ b/packages/views/inbox/components/inbox-filter-menu.test.tsx
@@ -1,6 +1,6 @@
// @vitest-environment jsdom
-import { afterEach, beforeEach, describe, expect, it } from "vitest";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
cleanup,
fireEvent,
@@ -19,6 +19,19 @@ import type { InboxItem, IssueStatusEntry } from "@multica/core/types";
import { renderWithI18n } from "../../test/i18n";
import { InboxFilterMenu } from "./inbox-filter-menu";
+// The directory hook resolves the current workspace through the route, which
+// this leaf render has none of — stubbed the same way the sibling
+// inbox-detail-label suite stubs it.
+const ACTOR_NAMES: Record<string, string> = { alice: "Alice", bob: "Bob" };
+vi.mock("@multica/core/workspace/hooks", () => ({
+ useActorName: () => ({
+ getActorName: (type: string, id: string) =>
+ type === "system" ? "Multica" : (ACTOR_NAMES[id] ?? "Unknown"),
+ getActorInitials: () => "??",
+ getActorAvatarUrl: () => null,
+ }),
+}));
+
function statusEntry(category: (typeof STATUS_ORDER)[number]): IssueStatusEntry {
return {
id: `status-${category}`,
@@ -40,6 +53,7 @@ function item(
id: string,
issueStatus: InboxItem["issue_status"],
issuePriority: InboxItem["issue_priority"],
+ overrides: Partial<InboxItem> = {},
): InboxItem {
return {
id,
@@ -59,6 +73,7 @@ function item(
archived: false,
created_at: "2026-08-24T00:00:00Z",
details: null,
+ ...overrides,
};
}
@@ -95,7 +110,7 @@ function renderMenu({
);
}
-async function openSubmenu(name: "Status" | "Priority") {
+async function openSubmenu(name: "From" | "Status" | "Priority") {
fireEvent.click(screen.getByRole("button", { name: "Filter inbox" }));
const trigger = await screen.findByRole("menuitem", {
name: new RegExp(`^${name}`),
@@ -160,6 +175,68 @@ describe("InboxFilterMenu", () => {
).toBeUndefined();
});
+ it("offers only the actors the visible rows carry", async () => {
+ renderMenu({
+ items: [
+ item("from-alice", "todo", "high", {
+ actor_type: "member",
+ actor_id: "alice",
+ }),
+ item("from-bob", "done", "low", {
+ actor_type: "agent",
+ actor_id: "bob",
+ }),
+ ],
+ });
+
+ await openSubmenu("From");
+ const alice = await screen.findByRole("menuitemcheckbox", {
+ name: /Alice.*1 notification/,
+ });
+ expect(
+ screen.getByRole("menuitemcheckbox", { name: /Bob.*1 notification/ }),
+ ).toBeTruthy();
+
+ fireEvent.click(alice);
+
+ expect(
+ useInboxFilterStore.getState().filtersByWorkspace["ws-1"]?.actors,
+ ).toEqual(["member:alice"]);
+ });
+
+ it("hides the From submenu when no row carries an actor", async () => {
+ renderMenu();
+
+ fireEvent.click(screen.getByRole("button", { name: "Filter inbox" }));
+
+ expect(screen.queryByRole("menuitem", { name: /^From/ })).toBeNull();
+ });
+
+ it("toggles unread only and counts the unread rows behind it", async () => {
+ renderMenu({
+ items: [
+ item("unread", "todo", "high"),
+ item("read", "done", "low", { read: true }),
+ ],
+ });
+
+ fireEvent.click(screen.getByRole("button", { name: "Filter inbox" }));
+ const unread = await screen.findByRole("menuitemcheckbox", {
+ name: /Unread only.*1 notification/,
+ });
+
+ fireEvent.click(unread);
+
+ expect(
+ useInboxFilterStore.getState().filtersByWorkspace["ws-1"]?.unreadOnly,
+ ).toBe(true);
+ await waitFor(() =>
+ expect(
+ screen.getByRole("button", { name: "1 active filter" }),
+ ).toHaveTextContent("1"),
+ );
+ });
+
it("hides priority and clears its filter for a legacy response", async () => {
useInboxFilterStore.getState().togglePriorityFilter("ws-1", "high");
renderMenu({
diff --git a/packages/views/inbox/components/inbox-filter-menu.tsx b/packages/views/inbox/components/inbox-filter-menu.tsx
index d5ee845897..cea19637d3 100644
--- a/packages/views/inbox/components/inbox-filter-menu.tsx
+++ b/packages/views/inbox/components/inbox-filter-menu.tsx
@@ -1,17 +1,21 @@
"use client";
import { useEffect, useMemo } from "react";
-import { CircleDot, Filter, RotateCcw, SignalHigh } from "lucide-react";
+import { CircleDot, Filter, Mail, RotateCcw, SignalHigh, UserRound } from "lucide-react";
import { PRIORITY_DISPLAY_ORDER } from "@multica/core/issues/config";
import {
filterInboxItems,
+ inboxActorKey,
+ inboxActorKeyParts,
inboxFiltersForPrioritySupport,
inboxFilterCount,
type InboxPriorityFilterSupport,
useInboxFilters,
useInboxFilterStore,
} from "@multica/core/inbox/filter-store";
+import { useActorName } from "@multica/core/workspace/hooks";
import type { InboxItem } from "@multica/core/types";
+import { ActorAvatar } from "@multica/ui/components/common/actor-avatar";
import { Button } from "@multica/ui/components/ui/button";
import {
DropdownMenu,
@@ -51,7 +55,17 @@ function priorityCounts(items: InboxItem[]): Map<string, number> {
return counts;
}
-/** Priority/status facets for the deduplicated list currently on screen. */
+function actorCounts(items: InboxItem[]): Map<string, number> {
+ const counts = new Map<string, number>();
+ for (const item of items) {
+ const key = inboxActorKey(item);
+ if (key == null) continue;
+ counts.set(key, (counts.get(key) ?? 0) + 1);
+ }
+ return counts;
+}
+
+/** Faceted filters for the deduplicated list currently on screen. */
export function InboxFilterMenu({
wsId,
items,
@@ -68,6 +82,11 @@ export function InboxFilterMenu({
const togglePriority = useInboxFilterStore(
(state) => state.togglePriorityFilter,
);
+ const toggleActor = useInboxFilterStore((state) => state.toggleActorFilter);
+ const toggleUnreadOnly = useInboxFilterStore(
+ (state) => state.toggleUnreadOnly,
+ );
+ const { getActorName, getActorInitials, getActorAvatarUrl } = useActorName();
const clearFilters = useInboxFilterStore((state) => state.clearFilters);
const clearPriorityFilters = useInboxFilterStore(
(state) => state.clearPriorityFilters,
@@ -108,24 +127,27 @@ export function InboxFilterMenu({
wsId,
]);
- // Counts are faceted: a status count respects the active priority filter
- // (and vice versa) while ignoring its own dimension, so every number says
- // how many rows selecting that value can actually reveal.
+ // Counts are faceted: every count respects the other active dimensions while
+ // ignoring its own, so each number says how many rows selecting that value
+ // can actually reveal.
const statusFacetItems = useMemo(
- () =>
- filterInboxItems(items, {
- statuses: [],
- priorities: effectiveFilters.priorities,
- }),
- [items, effectiveFilters.priorities],
+ () => filterInboxItems(items, { ...effectiveFilters, statuses: [] }),
+ [items, effectiveFilters],
);
const priorityFacetItems = useMemo(
+ () => filterInboxItems(items, { ...effectiveFilters, priorities: [] }),
+ [items, effectiveFilters],
+ );
+ const actorFacetItems = useMemo(
+ () => filterInboxItems(items, { ...effectiveFilters, actors: [] }),
+ [items, effectiveFilters],
+ );
+ const unreadCount = useMemo(
() =>
- filterInboxItems(items, {
- statuses: effectiveFilters.statuses,
- priorities: [],
- }),
- [items, effectiveFilters.statuses],
+ filterInboxItems(items, { ...effectiveFilters, unreadOnly: false }).filter(
+ (item) => item.read !== true,
+ ).length,
+ [items, effectiveFilters],
);
const statuses = useMemo(
() => statusCounts(statusFacetItems),
@@ -135,6 +157,27 @@ export function InboxFilterMenu({
() => priorityCounts(priorityFacetItems),
[priorityFacetItems],
);
+ const actors = useMemo(
+ () => actorCounts(actorFacetItems),
+ [actorFacetItems],
+ );
+ // The universe of actors comes from every row in the view rather than the
+ // faceted subset: picking one actor must not remove the others from the menu
+ // that offers them. Sorted by name so the list does not reshuffle as counts
+ // change under other selections.
+ const actorOptions = useMemo(() => {
+ const keys = new Set<string>();
+ for (const item of items) {
+ const key = inboxActorKey(item);
+ if (key != null) keys.add(key);
+ }
+ return [...keys]
+ .map((key) => {
+ const { type, id } = inboxActorKeyParts(key);
+ return { key, type, id, name: getActorName(type, id) };
+ })
+ .sort((a, b) => a.name.localeCompare(b.name));
+ }, [items, getActorName]);
const triggerLabel =
activeCount > 0
? t(($) => $.filters.active_count, { count: activeCount })
@@ -163,6 +206,63 @@ export function InboxFilterMenu({
)}
</DropdownMenuTrigger>
<DropdownMenuContent align="end" className="w-auto min-w-44">
+ <DropdownMenuCheckboxItem
+ checked={effectiveFilters.unreadOnly}
+ onCheckedChange={() => toggleUnreadOnly(wsId)}
+ >
+ <Mail className="size-3.5" />
+ <span className="flex-1">{t(($) => $.filters.unread_only)}</span>
+ {unreadCount > 0 && (
+ <span className="text-caption text-muted-foreground">
+ {t(($) => $.filters.notification_count, { count: unreadCount })}
+ </span>
+ )}
+ </DropdownMenuCheckboxItem>
+ <DropdownMenuSeparator />
+
+ {actorOptions.length > 0 && (
+ <DropdownMenuSub>
+ <DropdownMenuSubTrigger>
+ <UserRound className="size-3.5" />
+ <span className="flex-1">{t(($) => $.filters.from)}</span>
+ {effectiveFilters.actors.length > 0 && (
+ <span className="text-caption font-medium text-primary">
+ {effectiveFilters.actors.length}
+ </span>
+ )}
+ </DropdownMenuSubTrigger>
+ <DropdownMenuSubContent className="w-auto min-w-48">
+ {actorOptions.map((option) => {
+ const checked = effectiveFilters.actors.includes(option.key);
+ const count = actors.get(option.key) ?? 0;
+ return (
+ <DropdownMenuCheckboxItem
+ key={option.key}
+ checked={checked}
+ onCheckedChange={() => toggleActor(wsId, option.key)}
+ >
+ <ActorAvatar
+ size="xs"
+ name={option.name}
+ initials={getActorInitials(option.type, option.id)}
+ avatarUrl={getActorAvatarUrl(option.type, option.id)}
+ isAgent={option.type === "agent"}
+ isSquad={option.type === "squad"}
+ isSystem={option.type === "system"}
+ />
+ <span className="flex-1">{option.name}</span>
+ {count > 0 && (
+ <span className="text-caption text-muted-foreground">
+ {t(($) => $.filters.notification_count, { count })}
+ </span>
+ )}
+ </DropdownMenuCheckboxItem>
+ );
+ })}
+ </DropdownMenuSubContent>
+ </DropdownMenuSub>
+ )}
+
<DropdownMenuSub>
<DropdownMenuSubTrigger>
<CircleDot className="size-3.5" />
diff --git a/packages/views/inbox/components/inbox-page.test.tsx b/packages/views/inbox/components/inbox-page.test.tsx
index 36d6e2c8c7..299b37be32 100644
--- a/packages/views/inbox/components/inbox-page.test.tsx
+++ b/packages/views/inbox/components/inbox-page.test.tsx
@@ -279,6 +279,34 @@ describe("InboxPage", () => {
expect(screen.getByTestId("row")).toHaveTextContent("done-low");
});
+ it("hides read notifications while the unread filter is on", () => {
+ reset();
+ listData.active = [
+ item({ id: "unread-row", issue_id: "issue-1", read: false }),
+ item({ id: "read-row", issue_id: "issue-2", read: true }),
+ ];
+ useInboxFilterStore.getState().toggleUnreadOnly("workspace-1");
+
+ render(<InboxPage />);
+
+ expect(screen.getAllByTestId("row")).toHaveLength(1);
+ expect(screen.getByTestId("row")).toHaveTextContent("unread-row");
+ });
+
+ it("filters by the actor the row carries", () => {
+ reset();
+ listData.active = [
+ item({ id: "from-alice", issue_id: "issue-1", actor_type: "member", actor_id: "alice" }),
+ item({ id: "from-bob", issue_id: "issue-2", actor_type: "agent", actor_id: "bob" }),
+ ];
+ useInboxFilterStore.getState().toggleActorFilter("workspace-1", "member:alice");
+
+ render(<InboxPage />);
+
+ expect(screen.getAllByTestId("row")).toHaveLength(1);
+ expect(screen.getByTestId("row")).toHaveTextContent("from-alice");
+ });
+
it("offers to clear filters when they hide every notification", () => {
reset();
listData.active = [
diff --git a/packages/views/locales/en/inbox.json b/packages/views/locales/en/inbox.json
index a3a554c45e..0878aecb96 100644
--- a/packages/views/locales/en/inbox.json
+++ b/packages/views/locales/en/inbox.json
@@ -15,6 +15,8 @@
"active_count_other": "{{count}} active filters",
"status": "Status",
"priority": "Priority",
+ "from": "From",
+ "unread_only": "Unread only",
"notification_count_one": "{{count}} notification",
"notification_count_other": "{{count}} notifications",
"clear": "Clear filters",
diff --git a/packages/views/locales/ja/inbox.json b/packages/views/locales/ja/inbox.json
index d48e470b76..c0d99c9d80 100644
--- a/packages/views/locales/ja/inbox.json
+++ b/packages/views/locales/ja/inbox.json
@@ -14,6 +14,8 @@
"active_count_other": "{{count}} 件のフィルター",
"status": "ステータス",
"priority": "優先度",
+ "from": "送信者",
+ "unread_only": "未読のみ",
"notification_count_other": "{{count}} 件の通知",
"clear": "フィルターをクリア",
"empty": "フィルターに一致する通知はありません"
diff --git a/packages/views/locales/ko/inbox.json b/packages/views/locales/ko/inbox.json
index 3072aed5b3..6ace0a1280 100644
--- a/packages/views/locales/ko/inbox.json
+++ b/packages/views/locales/ko/inbox.json
@@ -14,6 +14,8 @@
"active_count_other": "필터 {{count}}개 적용됨",
"status": "상태",
"priority": "우선순위",
+ "from": "보낸 사람",
+ "unread_only": "읽지 않음만",
"notification_count_other": "알림 {{count}}개",
"clear": "필터 지우기",
"empty": "필터와 일치하는 알림이 없습니다"
diff --git a/packages/views/locales/zh-Hans/inbox.json b/packages/views/locales/zh-Hans/inbox.json
index ba3da6e12c..6f46862336 100644
--- a/packages/views/locales/zh-Hans/inbox.json
+++ b/packages/views/locales/zh-Hans/inbox.json
@@ -14,6 +14,8 @@
"active_count_other": "{{count}} 个筛选条件",
"status": "状态",
"priority": "优先级",
+ "from": "来自",
+ "unread_only": "只看未读",
"notification_count_other": "{{count}} 条通知",
"clear": "清除筛选",
"empty": "没有符合筛选条件的通知"