:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(signals): unassign yourself from inbox reports in triage and bulk (#114700)
Alex Lebedev01340f591571
diff --git a/frontend/src/lib/hooks/useKeyHeld.tsx b/frontend/src/lib/hooks/useKeyHeld.tsxindex 701c894ad483..950251e9ae78 100644--- a/frontend/src/lib/hooks/useKeyHeld.tsx+++ b/frontend/src/lib/hooks/useKeyHeld.tsx@@ -25,5 +25,12 @@ export function useKeyHeld(key: string): boolean {}})+ // A key released while the window is not focused sends no keyup, for example after Alt-Tab or+ // ⌘-Tab to another app. Without this reset the key reads as held when the user comes back.+ useEventListener('blur', () => {+ isHeldRef.current = false+ setKeyHeld(false)+ })+return keyHeld}diff --git a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsxindex e9bad158bc6a..d11275fd2e47 100644--- a/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx+++ b/products/signals/frontend/inbox/components/cards/ReportCard.test.tsx@@ -255,18 +255,30 @@ describe('ReportCard', () => {expect(screen.queryByText(/Held back|Judged not actionable/)).not.toBeInTheDocument()})- it('locks the selection while a bulk action is running', () => {- const setState = jest.spyOn(api.signalReports, 'setState').mockReturnValue(new Promise<never>(() => {}))+ it.each([+ {+ action: 'dismiss',+ hold: () => jest.spyOn(api.signalReports, 'setState').mockReturnValue(new Promise<never>(() => {})),+ start: () => logic.actions.bulkDismiss({ reason: 'other', note: '', correctedRepository: null }),+ },+ {+ action: 'unassign',+ hold: () => jest.spyOn(api, 'delete').mockReturnValue(new Promise<never>(() => {})),+ start: () => logic.actions.bulkUnassignMe(['r-1']),+ },+ ])('locks the selection while a bulk $action is running', ({ hold, start }) => {+ const pending = hold()act(() => {logic.actions.setSelectedReportIds(['r-1'])- logic.actions.bulkDismiss({ reason: 'other', note: '', correctedRepository: null })+ start()})expect(fireEvent.click(cardLink(), { metaKey: true })).toBe(true)expect(fireEvent.click(cardLink(), { ctrlKey: true })).toBe(true)expect(fireEvent.click(cardLink())).toBe(false)+ expect(fireEvent.click(cardLink(), { shiftKey: true })).toBe(false)expect(logic.values.selectedReportIds).toEqual(['r-1'])- setState.mockRestore()+ pending.mockRestore()})it('shows the affected-user snapshot in a redesigned row and prefers it over the primary metric', async () => {diff --git a/products/signals/frontend/inbox/components/cards/useReportCardSelection.ts b/products/signals/frontend/inbox/components/cards/useReportCardSelection.tsindex f9e00d4a3003..9f18f3e44bb9 100644--- a/products/signals/frontend/inbox/components/cards/useReportCardSelection.ts+++ b/products/signals/frontend/inbox/components/cards/useReportCardSelection.ts@@ -40,7 +40,7 @@ export interface ReportCardSelection {* pointer events into its actions, and it does nothing at all on a row the list marks unselectable.*/export function useReportCardSelection(reportId: string, enabled: boolean): ReportCardSelection {- const { hasSelection, isDismissing, isResolving } = useValues(inboxBulkActionsLogic)+ const { hasSelection, isDismissing, isResolving, isUnassigning } = useValues(inboxBulkActionsLogic)const { toggleReportSelection, selectRange } = useActions(inboxBulkActionsLogic)// Only this row's own flag, not the id list: reading the list subscribed every card to every// other card's selection, so picking one row repainted the whole inbox. The booleans above@@ -48,7 +48,7 @@ export function useReportCardSelection(reportId: string, enabled: boolean): Repoconst isReportSelected: boolean = useSelector((state) =>inboxBulkActionsLogic.selectors.selectedReportIds(state).includes(reportId))- const selectionDisabled = isDismissing || isResolving+ const selectionDisabled = isDismissing || isResolving || isUnassigningconst holdTimerRef = useRef<number | null>(null)const holdOriginRef = useRef<{ x: number; y: number } | null>(null)diff --git a/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.test.tsx b/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.test.tsxindex d19c01f7fa15..9598fc6c8f6c 100644--- a/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.test.tsx+++ b/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.test.tsx@@ -1,11 +1,14 @@import '@testing-library/jest-dom'import { cleanup, fireEvent, render, screen } from '@testing-library/react'+import { expectLogic } from 'kea-test-utils'+import { useMocks } from '~/mocks/jest'import { initKeaTests } from '~/test/init'import { inboxBulkActionsLogic } from '../../logics/inboxBulkActionsLogic'-import { type SignalReport, SignalReportStatus } from '../../types'+import { inboxFiltersLogic } from '../../logics/inboxFiltersLogic'+import { INBOX_SCOPE_ENTIRE_PROJECT, INBOX_SCOPE_FOR_YOU, type SignalReport, SignalReportStatus } from '../../types'import { InboxBulkSelectionBar } from './InboxBulkSelectionBar'function makeReport(id: string, overrides: Partial<SignalReport> = {}): SignalReport {@@ -36,6 +39,8 @@ describe('InboxBulkSelectionBar', () => {afterEach(() => {cleanup()logic.unmount()+ // The list scope persists to localStorage, so a test that changes it would leak into the next.+ localStorage.clear()})// The bar holds a count and no titles, so its dialogs have to count reports at every size. The@@ -69,4 +74,38 @@ describe('InboxBulkSelectionBar', () => {expect(await screen.findByText(/The pull request opened for this report is closed/)).toBeInTheDocument()})++ it.each([+ { scope: INBOX_SCOPE_ENTIRE_PROJECT, sent: ['b', 'c'], unassigned: ['b'] },+ { scope: INBOX_SCOPE_FOR_YOU, sent: ['a', 'b', 'c'], unassigned: ['a', 'b'] },+ ])('under $scope unassigns $sent and drops only the ones that succeeded', async ({ scope, sent, unassigned }) => {+ const deleted: string[] = []+ useMocks({+ delete: {+ '/api/projects/:team_id/signals/reports/:id/reviewers/me/': ({ params }) => {+ deleted.push(String(params.id))+ return params.id === 'c' ? [500, {}] : [204, null]+ },+ },+ })+ inboxFiltersLogic.mount()+ inboxFiltersLogic.actions.setScope(scope)+ logic.actions.setSelectedReportIds(['a', 'b', 'c'])+ render(+ <InboxBulkSelectionBar+ reports={[+ makeReport('a'),+ makeReport('b', { is_suggested_reviewer: true }),+ makeReport('c', { is_suggested_reviewer: true }),+ ]}+ />+ )++ await expectLogic(logic, () => {+ fireEvent.click(screen.getByText('Unassign me'))+ })+ .toDispatchActions([logic.actionCreators.unassignedMe(unassigned), 'bulkUnassignMeSuccess'])+ .toMatchValues({ selectedReportIds: [] })+ expect(deleted.sort()).toEqual(sent)+ })})diff --git a/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.tsx b/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.tsxindex 89e9b2411e66..f76ca0e6ca04 100644--- a/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.tsx+++ b/products/signals/frontend/inbox/components/shell/InboxBulkSelectionBar.tsx@@ -1,30 +1,36 @@import { useActions, useValues } from 'kea'-import { IconCheckCircle, IconHide, IconX } from '@posthog/icons'+import { IconCheckCircle, IconHide, IconLeave, IconX } from '@posthog/icons'import { LemonButton } from '@posthog/lemon-ui'import { inboxBulkActionsLogic } from '../../logics/inboxBulkActionsLogic'+import { inboxFiltersLogic } from '../../logics/inboxFiltersLogic'import type { SignalReport } from '../../types'-import { hasOpenImplementationPr } from '../../utils/reportActions'+import { canUnassignMe, hasOpenImplementationPr } from '../../utils/reportActions'import { openDismissReportDialog } from './DismissReportDialog'import { openResolveReportDialog } from './ResolveReportDialog'/*** Bulk action toolbar shown when one or more reports are multi-selected.- * Mirrors desktop `InboxBulkSelectionBar` (the dismiss + clear slice) plus Resolve. Selection- * and the bulk state calls live in `inboxBulkActionsLogic`; delete / reingest+ * Mirrors desktop `InboxBulkSelectionBar` (the dismiss + clear slice) plus Resolve and Unassign me.+ * Selection and the bulk state calls live in `inboxBulkActionsLogic`; delete / reingest* remain on `inboxSceneLogic` per-report.*/export function InboxBulkSelectionBar({ reports }: { reports: SignalReport[] }): JSX.Element | null {- const { selectedCount, selectedReportIds, isDismissing, isResolving } = useValues(inboxBulkActionsLogic)- const { clearSelection, bulkDismiss, bulkResolve } = useActions(inboxBulkActionsLogic)+ const { selectedCount, selectedReportIds, isDismissing, isResolving, isUnassigning } =+ useValues(inboxBulkActionsLogic)+ const { clearSelection, bulkDismiss, bulkResolve, bulkUnassignMe } = useActions(inboxBulkActionsLogic)+ const { isScopedToMe } = useValues(inboxFiltersLogic)if (selectedCount === 0) {return null}- const busy = isDismissing || isResolving+ const busy = isDismissing || isResolving || isUnassigningconst selectedIds = new Set(selectedReportIds)const hasOpenPr = reports.some((report) => selectedIds.has(report.id) && hasOpenImplementationPr(report))+ const unassignableIds = reports+ .filter((report) => selectedIds.has(report.id) && canUnassignMe(report, isScopedToMe))+ .map((report) => report.id)return (<div className="flex items-center justify-between gap-3 flex-wrap rounded border border-accent bg-accent-highlight-secondary px-3 py-2">@@ -68,6 +74,23 @@ export function InboxBulkSelectionBar({ reports }: { reports: SignalReport[] }):>Dismiss</LemonButton>+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconLeave />}+ loading={isUnassigning}+ disabledReason={+ busy+ ? 'Working…'+ : unassignableIds.length === 0+ ? "You're not a reviewer on any selected report"+ : undefined+ }+ onClick={() => bulkUnassignMe(unassignableIds)}+ data-attr="inbox-bulk-unassign-me"+ >+ Unassign me+ </LemonButton><LemonButtontype="tertiary"size="small"diff --git a/products/signals/frontend/inbox/components/triage/DismissOrUnassignButton.tsx b/products/signals/frontend/inbox/components/triage/DismissOrUnassignButton.tsxnew file mode 100644index 000000000000..3e5d252cfa50--- /dev/null+++ b/products/signals/frontend/inbox/components/triage/DismissOrUnassignButton.tsx@@ -0,0 +1,45 @@+import { useActions, useValues } from 'kea'++import { IconHide } from '@posthog/icons'+import { LemonButton } from '@posthog/lemon-ui'++import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'++import { inboxTriageLogic } from '../../logics/inboxTriageLogic'++/**+ * The footer has no room for another button, so Unassign me takes the Dismiss slot while the command+ * key is held, and the reader sees what the chord will do before U is pressed. Unassign me has no icon+ * so that it fits the width Dismiss leaves free: a wider button would wrap the row each time the key+ * goes down.+ */+export function DismissOrUnassignButton({ commandKeyHeld }: { commandKeyHeld: boolean }): JSX.Element {+ const { unassignDisabledReason, isUnassigningCurrent } = useValues(inboxTriageLogic)+ const { dismissCurrent, unassignCurrent } = useActions(inboxTriageLogic)++ return commandKeyHeld ? (+ <LemonButton+ type="secondary"+ size="small"+ onClick={unassignCurrent}+ loading={isUnassigningCurrent}+ disabledReason={unassignDisabledReason}+ sideIcon={<KeyboardShortcut command u />}+ data-attr="inbox-triage-unassign-me"+ >+ Unassign me+ </LemonButton>+ ) : (+ <LemonButton+ type="secondary"+ size="small"+ icon={<IconHide />}+ onClick={dismissCurrent}+ sideIcon={<KeyboardShortcut a />}+ // pinned: data-attr predates the Archive → Dismiss rename; dashboards read it.+ data-attr="inbox-triage-archive"+ >+ Dismiss+ </LemonButton>+ )+}diff --git a/products/signals/frontend/inbox/components/triage/InboxTriageView.tsx b/products/signals/frontend/inbox/components/triage/InboxTriageView.tsxindex 7d68de4353e4..f12bc52abb16 100644--- a/products/signals/frontend/inbox/components/triage/InboxTriageView.tsx+++ b/products/signals/frontend/inbox/components/triage/InboxTriageView.tsx@@ -2,14 +2,16 @@ import { useActions, useValues } from 'kea'import { router } from 'kea-router'import { useEffect, useRef } from 'react'-import { IconArrowLeft, IconCheckCircle, IconHide, IconPullRequest } from '@posthog/icons'+import { IconArrowLeft, IconCheckCircle, IconPullRequest } from '@posthog/icons'import { LemonButton, LemonSkeleton, Link, Tooltip } from '@posthog/lemon-ui'import { KeyboardShortcut } from 'lib/components/KeyboardShortcut/KeyboardShortcut'import { TZLabel } from 'lib/components/TZLabel'import { HotkeyInterface, useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys'+import { useKeyHeld } from 'lib/hooks/useKeyHeld'import { LemonMarkdown } from 'lib/lemon-ui/LemonMarkdown'import { cn } from 'lib/utils/css-classes'+import { isMac } from 'lib/utils/dom'import { urls } from 'scenes/urls'import { captureInboxPanelViewed } from '../../inboxAnalytics'@@ -22,21 +24,29 @@ import {} from '../../utils/reportPresentation'import { SignalReportPriorityBadge } from '../badges/SignalReportPriorityBadge'import { ConventionalCommitScopeTag, InboxCardSourceMeta } from '../cards/ReportCard'+import { DismissOrUnassignButton } from './DismissOrUnassignButton'/*** Wrap a hotkey so it stays quiet while a dialog (the archive form) is up. The hotkey listener sits* on `window`, and a modal's buttons are not inputs, so without this pressing the archive key on the* archive dialog's own button would stack a second dialog.*/-function outsideDialogs(action: () => void): HotkeyInterface['action'] {+function outsideDialogs(action: (event: KeyboardEvent) => void): HotkeyInterface['action'] {return (event) => {if ((event.target as Element | null)?.closest?.('.LemonModal')) {return}- action()+ action(event)}}+const IS_MAC = isMac()+const COMMAND_KEY = IS_MAC ? 'Meta' : 'Control'++function isCommandKeyDown(event: KeyboardEvent): boolean {+ return IS_MAC ? event.metaKey : event.ctrlKey+}+export type TriageEnterIntent = 'passthrough' | 'open' | 'toggle'/**@@ -94,10 +104,12 @@ function HintBarItem({ shortcut, label }: { shortcut: JSX.Element; label: string)}-function TriageCard({ report, expanded }: { report: SignalReport; expanded: boolean }): JSX.Element {+export function TriageCard({ report, expanded }: { report: SignalReport; expanded: boolean }): JSX.Element {const { canCreatePr, isCreatingPr, createPrDisabledReason, currentReportUrl } = useValues(inboxTriageLogic)- const { dismissCurrent, resolveCurrent, createPrForCurrent, openCurrent, toggleExpanded } =- useActions(inboxTriageLogic)+ const { resolveCurrent, createPrForCurrent, openCurrent, toggleExpanded } = useActions(inboxTriageLogic)+ // Read above the article keyed by report, so a key still held after Unassign me survives the+ // move to the next report.+ const commandKeyHeld = useKeyHeld(COMMAND_KEY)const conventionalTitle = parseConventionalCommitTitle(report.title)const title = displayConventionalCommitTitle(report.title, 'Untitled report')@@ -198,17 +210,7 @@ function TriageCard({ report, expanded }: { report: SignalReport; expanded: bool>Resolve</LemonButton>- <LemonButton- type="secondary"- size="small"- icon={<IconHide />}- onClick={dismissCurrent}- sideIcon={<KeyboardShortcut a />}- // pinned: data-attr predates the Archive → Dismiss rename; dashboards read it.- data-attr="inbox-triage-archive"- >- Dismiss- </LemonButton>+ <DismissOrUnassignButton commandKeyHeld={commandKeyHeld} />{canCreatePr && (<LemonButtontype="primary"@@ -270,6 +272,7 @@ export function InboxTriageView(): JSX.Element {setExpanded,dismissCurrent,resolveCurrent,+ unassignCurrent,createPrForCurrent,openCurrent,ensureLoaded,@@ -299,6 +302,17 @@ export function InboxTriageView(): JSX.Element {e: { action: outsideDialogs(() => toggleExpanded()) },o: { action: outsideDialogs(() => openCurrent()) },a: { action: outsideDialogs(() => dismissCurrent()) },+ u: {+ action: outsideDialogs((event) => {+ if (!isCommandKeyDown(event) || event.shiftKey || event.altKey) {+ return+ }+ // The chord replaces the browser's own ⌘U / Ctrl+U (view page source) in triage.+ event.preventDefault()+ unassignCurrent()+ }),+ willHandleEvent: true,+ },r: { action: outsideDialogs(() => resolveCurrent()) },c: { action: outsideDialogs(() => createPrForCurrent()) },escape: {@@ -319,6 +333,7 @@ export function InboxTriageView(): JSX.Element {setExpanded,dismissCurrent,resolveCurrent,+ unassignCurrent,createPrForCurrent,openCurrent,]diff --git a/products/signals/frontend/inbox/components/triage/TriageCard.test.tsx b/products/signals/frontend/inbox/components/triage/TriageCard.test.tsxnew file mode 100644index 000000000000..f303e8a205d7--- /dev/null+++ b/products/signals/frontend/inbox/components/triage/TriageCard.test.tsx@@ -0,0 +1,64 @@+/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */+import '@testing-library/jest-dom'++import { cleanup, fireEvent, render, screen } from '@testing-library/react'++import { useMocks } from '~/mocks/jest'+import { initKeaTests } from '~/test/init'++import { inboxTriageLogic } from '../../logics/inboxTriageLogic'+import { SignalReport, SignalReportStatus } from '../../types'+import { TriageCard } from './InboxTriageView'++jest.mock('lib/components/TZLabel', () => ({+ TZLabel: ({ time }: { time: string }) => <span>{time}</span>,+}))++function makeReport(id: string): SignalReport {+ return {+ id,+ title: `Report ${id}`,+ summary: 'summary',+ status: SignalReportStatus.READY,+ total_weight: 0,+ signal_count: 1,+ artefact_count: 0,+ is_suggested_reviewer: true,+ priority: 'P2',+ source_products: ['error_tracking'],+ created_at: '2026-06-11T10:00:00Z',+ updated_at: '2026-06-11T10:00:00Z',+ } satisfies SignalReport+}++describe('TriageCard', () => {+ let logic: ReturnType<typeof inboxTriageLogic.build>++ beforeEach(() => {+ useMocks({+ get: {+ '/api/projects/:team_id/signals/reports/available_reviewers': {},+ '/api/projects/:team_id/signals/reports/': { count: 0, next: null, previous: null, results: [] },+ },+ })+ initKeaTests()+ logic = inboxTriageLogic()+ logic.mount()+ })++ afterEach(() => {+ cleanup()+ logic.unmount()+ })++ it('keeps Unassign me on the next report while the command key stays held', () => {+ const { rerender } = render(<TriageCard report={makeReport('r-1')} expanded={false} />)+ fireEvent.keyDown(window, { key: 'Control' })+ expect(screen.getByText('Unassign me')).toBeInTheDocument()++ rerender(<TriageCard report={makeReport('r-2')} expanded={false} />)++ expect(screen.getByText('Unassign me')).toBeInTheDocument()+ expect(screen.queryByText('Dismiss')).not.toBeInTheDocument()+ })+})diff --git a/products/signals/frontend/inbox/logics/inboxBulkActionsLogic.ts b/products/signals/frontend/inbox/logics/inboxBulkActionsLogic.tsindex 1819c8a41c4f..969572ac5f2b 100644--- a/products/signals/frontend/inbox/logics/inboxBulkActionsLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxBulkActionsLogic.ts@@ -1,8 +1,12 @@-import { MakeLogicType, actions, kea, listeners, path, reducers, selectors } from 'kea'+import { MakeLogicType, actions, connect, kea, listeners, path, reducers, selectors } from 'kea'import { lemonToast } from '@posthog/lemon-ui'import api from 'lib/api'+import { pluralize } from 'lib/utils/strings'+import { teamLogic } from 'scenes/teamLogic'++import { signalsReportsReviewersMeDestroy } from 'products/signals/frontend/generated/api'import { captureInboxReportAction } from '../inboxAnalytics'import { type DismissalFeedback, type ResolveReasonValue, suppressDismissalPayload } from '../utils/dismissalReasons'@@ -22,11 +26,21 @@ function formatBulkSummary(result: BulkActionResult, verb: 'dismissed' | 'resolvreturn `${successCount} ${pluralized} ${verb}, ${failureCount} failed`}+function formatUnassignSummary({ successCount, failureCount }: BulkActionResult): string {+ if (successCount === 0) {+ return `Couldn't unassign you from ${pluralize(failureCount, 'report')}. Try again.`+ }+ const unassigned = `Unassigned you from ${pluralize(successCount, 'report')}`+ return failureCount === 0 ? unassigned : `${unassigned}, ${failureCount} failed`+}+// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface inboxBulkActionsLogicValues {+ currentTeamId: number | null // teamLogichasSelection: booleanisDismissing: booleanisResolving: boolean+ isUnassigning: booleanselectedCount: numberselectedReportIds: string[]selectionAnchorId: string | null@@ -57,6 +71,15 @@ export interface inboxBulkActionsLogicActions {bulkResolveSuccess: () => {value: true}+ bulkUnassignMe: (reportIds: string[]) => {+ reportIds: string[]+ }+ bulkUnassignMeFailure: () => {+ value: true+ }+ bulkUnassignMeSuccess: () => {+ value: true+ }clearSelection: () => {value: true}@@ -85,6 +108,9 @@ export interface inboxBulkActionsLogicActions {toggleReportSelection: (reportId: string) => {reportId: string}+ unassignedMe: (reportIds: string[]) => {+ reportIds: string[]+ }}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -103,7 +129,7 @@ export type inboxBulkActionsLogicType = MakeLogicType<>/**- * Multi-select + bulk dismiss / resolve for the inbox report list. Mirrors desktop+ * Multi-select + bulk dismiss / resolve / unassign for the inbox report list. Mirrors desktop* `inboxReportSelectionStore` (selection state) and `useInboxBulkActions`* (bulk suppress via `updateSignalReportState`). It owns the selected id set, the rendered row* order a shift-click ranges over, and the state calls; the card components own the pointer@@ -112,6 +138,10 @@ export type inboxBulkActionsLogicType = MakeLogicType<export const inboxBulkActionsLogic = kea<inboxBulkActionsLogicType>([path(['scenes', 'inbox', 'logics', 'inboxBulkActionsLogic']),+ connect(() => ({+ values: [teamLogic, ['currentTeamId']],+ })),+actions({toggleReportSelection: (reportId: string) => ({ reportId }),setSelectedReportIds: (reportIds: string[]) => ({ reportIds }),@@ -129,6 +159,12 @@ export const inboxBulkActionsLogic = kea<inboxBulkActionsLogicType>([bulkResolve: (reason: ResolveReasonValue, note: string) => ({ reason, note }),bulkResolveSuccess: true,bulkResolveFailure: true,+ bulkUnassignMe: (reportIds: string[]) => ({ reportIds }),+ bulkUnassignMeSuccess: true,+ bulkUnassignMeFailure: true,+ /** Broadcast that the signed-in user is no longer a suggested reviewer on these reports, so a+ * list scoped to them drops the rows in place and every other list stops marking them as theirs. */+ unassignedMe: (reportIds: string[]) => ({ reportIds }),/** Broadcast that a single report changed state elsewhere (dismissed, resolved, or refunded in* the detail pane), so every mounted list reconciles itself. Persisting the change is the* caller's responsibility. */@@ -192,6 +228,14 @@ export const inboxBulkActionsLogic = kea<inboxBulkActionsLogicType>([bulkResolveFailure: () => false,},],+ isUnassigning: [+ false,+ {+ bulkUnassignMe: () => true,+ bulkUnassignMeSuccess: () => false,+ bulkUnassignMeFailure: () => false,+ },+ ],}),selectors({@@ -322,5 +366,42 @@ export const inboxBulkActionsLogic = kea<inboxBulkActionsLogicType>([}actions.bulkResolveSuccess()},+ bulkUnassignMe: async ({ reportIds }) => {+ if (reportIds.length === 0) {+ actions.bulkUnassignMeFailure()+ return+ }+ captureInboxReportAction({+ actionType: 'remove_suggested_reviewer',+ surface: 'bulk_bar',+ isBulk: true,+ bulkSize: reportIds.length,+ })+ const projectId = String(values.currentTeamId)+ const results = await Promise.allSettled(+ reportIds.map((id) => signalsReportsReviewersMeDestroy(projectId, id))+ )+ const unassignedIds = reportIds.filter((_, index) => results[index].status === 'fulfilled')+ const result: BulkActionResult = {+ successCount: unassignedIds.length,+ failureCount: reportIds.length - unassignedIds.length,+ }++ actions.clearSelection()+ if (unassignedIds.length > 0) {+ actions.unassignedMe(unassignedIds)+ }++ if (result.failureCount > 0) {+ lemonToast.error(formatUnassignSummary(result))+ } else {+ lemonToast.success(formatUnassignSummary(result))+ }+ if (result.successCount === 0) {+ actions.bulkUnassignMeFailure()+ } else {+ actions.bulkUnassignMeSuccess()+ }+ },})),])diff --git a/products/signals/frontend/inbox/logics/inboxFiltersLogic.ts b/products/signals/frontend/inbox/logics/inboxFiltersLogic.tsindex a47d02dcdbb1..12158a582377 100644--- a/products/signals/frontend/inbox/logics/inboxFiltersLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxFiltersLogic.ts@@ -289,6 +289,7 @@ export interface inboxFiltersLogicValues {hasActiveFilters: booleanhasUserChosenScope: booleanisRedesign: boolean+ isScopedToMe: booleanknownTeammate: {label: stringuuid: string@@ -405,6 +406,7 @@ export interface inboxFiltersLogicMeta {priorityFilter: SignalReportPriority[],activeCreatedWindow: InboxCreatedWindow | null) => boolean+ isScopedToMe: (scope: InboxScope, user: UserType | null) => booleanmodelSortAvailable: (featureFlags: FeatureFlagsSet, user: UserType | null) => booleanactiveSortField: (sortField: InboxSortField, modelSortAvailable: boolean) => InboxSortFieldactiveSortDirection: (@@ -702,6 +704,11 @@ export const inboxFiltersLogic = kea<inboxFiltersLogicType>([priorityFilter.length > 0 ||activeCreatedWindow !== null,],+ isScopedToMe: [+ (s) => [s.scope, s.user],+ (scope: InboxScope, user: UserType | null): boolean =>+ !!user?.uuid && (scope === INBOX_SCOPE_FOR_YOU || parseTeammateInboxScope(scope) === user.uuid),+ ],// Staff only, the same rule as the `ranking` field the backend returns.modelSortAvailable: [(s) => [s.featureFlags, s.user],diff --git a/products/signals/frontend/inbox/logics/inboxTriageLogic.test.ts b/products/signals/frontend/inbox/logics/inboxTriageLogic.test.tsindex 1e69cdf4ba29..bc287f2d4ae8 100644--- a/products/signals/frontend/inbox/logics/inboxTriageLogic.test.ts+++ b/products/signals/frontend/inbox/logics/inboxTriageLogic.test.ts@@ -1,4 +1,5 @@/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */+import { waitFor } from '@testing-library/react'import { router } from 'kea-router'import { expectLogic } from 'kea-test-utils'@@ -11,7 +12,8 @@ import { initKeaTests } from '~/test/init'import { openDismissReportDialog } from '../components/shell/DismissReportDialog'import { openResolveReportDialog } from '../components/shell/ResolveReportDialog'-import { SignalReport, SignalReportStatus } from '../types'+import { INBOX_SCOPE_ENTIRE_PROJECT, INBOX_SCOPE_FOR_YOU, SignalReport, SignalReportStatus } from '../types'+import { inboxFiltersLogic } from './inboxFiltersLogic'import { inboxTriageLogic } from './inboxTriageLogic'jest.mock('../components/shell/DismissReportDialog', () => ({ openDismissReportDialog: jest.fn() }))@@ -79,7 +81,11 @@ describe('inboxTriageLogic', () => {})})- afterEach(() => logic?.unmount())+ afterEach(() => {+ logic?.unmount()+ // The list scope persists to localStorage, so a test that changes it would leak into the next.+ localStorage.clear()+ })async function mountAt(searchParams: Record<string, unknown>): Promise<void> {router.actions.push(urls.inboxTriage(), searchParams)@@ -106,6 +112,104 @@ describe('inboxTriageLogic', () => {expect(openDismissReportDialog).toHaveBeenCalledWith(expect.objectContaining({ hasOpenPr: true }))})+ it.each([+ { scope: INBOX_SCOPE_FOR_YOU, mine: true, expectedId: 'r-3', stillQueued: false, unassigned: ['r-2'] },+ { scope: INBOX_SCOPE_ENTIRE_PROJECT, mine: true, expectedId: 'r-3', stillQueued: true, unassigned: ['r-2'] },+ { scope: INBOX_SCOPE_ENTIRE_PROJECT, mine: false, expectedId: 'r-2', stillQueued: true, unassigned: [] },+ { scope: INBOX_SCOPE_FOR_YOU, mine: false, expectedId: 'r-3', stillQueued: false, unassigned: ['r-2'] },+ ])(+ 'unassigning me under $scope (reviewer: $mine) lands on $expectedId',+ async ({ scope, mine, expectedId, stillQueued, unassigned }) => {+ const reports = FIRST_PAGE.slice(0, 5).map((r) => ({ ...r, is_suggested_reviewer: mine }))+ const deleted: string[] = []+ useMocks({+ get: { [REPORTS_URL]: { count: reports.length, next: null, previous: null, results: reports } },+ delete: {+ '/api/projects/:team_id/signals/reports/:id/reviewers/me/': ({ params }) => {+ deleted.push(String(params.id))+ return [204, null]+ },+ },+ })+ await mountAt({ report: 'r-2', at: 2 })+ inboxFiltersLogic.actions.setScope(scope)+ await expectLogic(logic).toFinishAllListeners()++ logic.actions.unassignCurrent()+ await expectLogic(logic).toFinishAllListeners()++ expect(logic.values.currentReport?.id).toBe(expectedId)+ expect(logic.values.reports.some((r) => r.id === 'r-2')).toBe(stillQueued)+ expect(deleted).toEqual(unassigned)+ }+ )++ it('sends one unassign request for the last report while the first one is pending', async () => {+ const report = { ...makeReport('last'), is_suggested_reviewer: true }+ const deleted: string[] = []+ let finishDelete: () => void = () => {}+ useMocks({+ get: { [REPORTS_URL]: { count: 1, next: null, previous: null, results: [report] } },+ delete: {+ '/api/projects/:team_id/signals/reports/:id/reviewers/me/': async ({ params }) => {+ deleted.push(String(params.id))+ await new Promise<void>((resolve) => (finishDelete = resolve))+ return [204, null]+ },+ },+ })+ await mountAt({ report: report.id, at: 0 })+ inboxFiltersLogic.actions.setScope(INBOX_SCOPE_ENTIRE_PROJECT)+ await expectLogic(logic).toFinishAllListeners()++ logic.actions.unassignCurrent()+ logic.actions.unassignCurrent()+ expect(logic.values.isUnassigningCurrent).toBe(true)+ await waitFor(() => expect(deleted).toEqual(['last']))+ finishDelete()+ await expectLogic(logic).toFinishAllListeners()++ expect(deleted).toEqual(['last'])+ expect(logic.values.isUnassigningCurrent).toBe(false)+ })++ it('loads the next page when unassigning me moves triage near the end of the loaded reports', async () => {+ const mine = (reports: SignalReport[]): SignalReport[] =>+ reports.map((r) => ({ ...r, is_suggested_reviewer: true }))+ useMocks({+ get: {+ [REPORTS_URL]: ({ request }) => {+ const offset = new URL(request.url).searchParams.get('offset')+ requestedOffsets.push(offset)+ const firstPage = offset === '0' || offset === null+ return [+ 200,+ {+ count: FIRST_PAGE.length + SECOND_PAGE.length,+ next: firstPage+ ? `http://localhost/api/projects/997/signals/reports/?offset=${PAGE_SIZE}`+ : null,+ previous: null,+ results: mine(firstPage ? FIRST_PAGE : SECOND_PAGE),+ },+ ]+ },+ },+ delete: { '/api/projects/:team_id/signals/reports/:id/reviewers/me/': [204, null] },+ })+ await mountAt({ report: `r-${PAGE_SIZE - 2}`, at: PAGE_SIZE - 2 })+ inboxFiltersLogic.actions.setScope(INBOX_SCOPE_ENTIRE_PROJECT)+ await expectLogic(logic).toFinishAllListeners()+ requestedOffsets = []++ logic.actions.unassignCurrent()+ await expectLogic(logic).toFinishAllListeners()++ expect(logic.values.currentReport?.id).toBe(`r-${PAGE_SIZE - 1}`)+ expect(requestedOffsets).toEqual([String(PAGE_SIZE)])+ expect(logic.values.nextReport?.id).toBe(`r-${PAGE_SIZE}`)+ })+it.each([{name: 'lands on the report the URL names',diff --git a/products/signals/frontend/inbox/logics/inboxTriageLogic.ts b/products/signals/frontend/inbox/logics/inboxTriageLogic.tsindex 231506a537b3..5267f561abbe 100644--- a/products/signals/frontend/inbox/logics/inboxTriageLogic.ts+++ b/products/signals/frontend/inbox/logics/inboxTriageLogic.ts@@ -9,7 +9,7 @@ import { captureInboxReportAction } from '../inboxAnalytics'import { inboxSceneLogic } from '../inboxSceneLogic'import { inboxTaskKickoffLogic } from '../inboxTaskKickoffLogic'import { INBOX_PRIMARY_REPORT_SECTION_KEY, InboxReportSectionKey, SignalReport } from '../types'-import { canCreateImplementationPr, hasOpenImplementationPr } from '../utils/reportActions'+import { canCreateImplementationPr, canUnassignMe, hasOpenImplementationPr } from '../utils/reportActions'import { displayConventionalCommitTitle } from '../utils/reportPresentation'import { INBOX_REPORT_SECTION_LIST_PARAMS, reportListLogic } from './reportListLogic'@@ -38,9 +38,11 @@ export interface inboxTriageLogicValues {isCreatingPr: boolean // inboxTaskKickoffLogichasMore: boolean // reportListLogicisLoaded: boolean // reportListLogic+ isScopedToMe: boolean // reportListLogicreports: SignalReport[] // reportListLogicreportsLoadFailed: boolean // reportListLogicreportsResponseLoading: boolean // reportListLogic+ unassigningReportIds: string[] // reportListLogiccanCreatePr: booleancounter: stringcurrentIndex: number@@ -48,6 +50,7 @@ export interface inboxTriageLogicValues {currentReportUrl: string | nullexpanded: booleanisRestoringPosition: boolean+ isUnassigningCurrent: booleannextReport: SignalReport | nullpreviousReport: SignalReport | nullrequestedIndex: number@@ -55,6 +58,7 @@ export interface inboxTriageLogicValues {requestedReportIndex: numberrestoreFailed: booleanreturnUrl: string+ unassignDisabledReason: string | null}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -119,6 +123,13 @@ export interface inboxTriageLogicActions {reason: 'already_fixed' | 'fixed_outside_posthog' | 'other' | 'pr_merged'reportId: string} // reportListLogic+ unassignMe: (+ reportId: string,+ surface: import('../inboxAnalytics').InboxReportActionSurface+ ) => {+ reportId: string+ surface: import('../inboxAnalytics').InboxReportActionSurface+ } // reportListLogiccreatePrForCurrent: () => {value: true}@@ -132,6 +143,13 @@ export interface inboxTriageLogicActions {index: numberreportId: string | null}+ goToReport: (+ reportId: string,+ index: number+ ) => {+ index: number+ reportId: string+ }navigate: (delta: number) => {delta: number}@@ -150,6 +168,9 @@ export interface inboxTriageLogicActions {toggleExpanded: () => {value: true}+ unassignCurrent: () => {+ value: true+ }}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -169,6 +190,12 @@ export interface inboxTriageLogicMeta {nextReport: (reports: SignalReport[], currentIndex: number) => SignalReport | nullcounter: (reports: SignalReport[], currentIndex: number, hasMore: boolean) => stringcanCreatePr: (currentReport: SignalReport | null) => boolean+ isUnassigningCurrent: (currentReport: SignalReport | null, unassigningReportIds: string[]) => boolean+ unassignDisabledReason: (+ currentReport: SignalReport | null,+ isUnassigningCurrent: boolean,+ isScopedToMe: boolean+ ) => string | nullreturnUrl: (currentReport: SignalReport | null, currentIndex: number) => stringcurrentReportUrl: (currentReport: SignalReport | null, returnUrl: string) => string | null}@@ -192,7 +219,15 @@ export const inboxTriageLogic = kea<inboxTriageLogicType>([connect(() => ({values: [reportListLogic(TRIAGE_LIST_PROPS),- ['reports', 'hasMore', 'isLoaded', 'reportsResponseLoading', 'reportsLoadFailed'],+ [+ 'reports',+ 'hasMore',+ 'isLoaded',+ 'reportsResponseLoading',+ 'reportsLoadFailed',+ 'unassigningReportIds',+ 'isScopedToMe',+ ],inboxTaskKickoffLogic,['isCreatingPr', 'createPrDisabledReason'],],@@ -203,6 +238,7 @@ export const inboxTriageLogic = kea<inboxTriageLogicType>(['loadMore','dismissReport','resolveReport',+ 'unassignMe','removeReport','loadReportsSuccess','loadMoreReportsSuccess',@@ -220,10 +256,13 @@ export const inboxTriageLogic = kea<inboxTriageLogicType>([setIndex: (index: number) => ({ index }),// Restore a spot carried in the triage URL: the report the user was on, and where it sat.focusReport: (reportId: string | null, index: number) => ({ reportId, index }),+ // Move to a report by id, so the spot holds whether or not the rows above it leave the queue.+ goToReport: (reportId: string, index: number) => ({ reportId, index }),toggleExpanded: true,setExpanded: (expanded: boolean) => ({ expanded }),dismissCurrent: true,resolveCurrent: true,+ unassignCurrent: true,createPrForCurrent: true,openCurrent: true,}),@@ -236,6 +275,7 @@ export const inboxTriageLogic = kea<inboxTriageLogicType>([{setIndex: (_, { index }) => index,focusReport: (_, { index }) => index,+ goToReport: (_, { index }) => index,},],// The report the URL says the user is on. It wins over the index while it is still in the@@ -244,6 +284,7 @@ export const inboxTriageLogic = kea<inboxTriageLogicType>([null as string | null,{focusReport: (_, { reportId }) => reportId,+ goToReport: (_, { reportId }) => reportId,setIndex: () => null,},],@@ -316,6 +357,20 @@ export const inboxTriageLogic = kea<inboxTriageLogicType>([(currentReport: SignalReport | null): boolean =>currentReport !== null && canCreateImplementationPr(currentReport),],+ isUnassigningCurrent: [+ (s) => [s.currentReport, s.unassigningReportIds],+ (currentReport: SignalReport | null, unassigningReportIds: string[]): boolean =>+ currentReport !== null && unassigningReportIds.includes(currentReport.id),+ ],+ unassignDisabledReason: [+ (s) => [s.currentReport, s.isUnassigningCurrent, s.isScopedToMe],+ (currentReport: SignalReport | null, isUnassigningCurrent: boolean, isScopedToMe: boolean): string | null =>+ currentReport && !canUnassignMe(currentReport, isScopedToMe)+ ? "You're not a reviewer on this report"+ : isUnassigningCurrent+ ? 'Unassigning you…'+ : null,+ ],// The triage URL for the current spot; what a report opened from here returns to.returnUrl: [(s) => [s.currentReport, s.currentIndex],@@ -340,18 +395,22 @@ export const inboxTriageLogic = kea<inboxTriageLogicType>([actions.loadMore()}}+ // Fetch the next page before the user reaches the end of the loaded ones.+ const prefetchNearEnd = (): void => {+ if (+ values.hasMore &&+ !values.reportsResponseLoading &&+ values.currentIndex >= values.reports.length - PREFETCH_THRESHOLD+ ) {+ actions.loadMore()+ }+ }return {loadReportsSuccess: loadTowardRequestedSpot,loadMoreReportsSuccess: loadTowardRequestedSpot,navigate: ({ delta }) => {actions.setIndex(clampIndex(values.currentIndex + delta, values.reports.length))- if (- values.hasMore &&- !values.reportsResponseLoading &&- values.currentIndex >= values.reports.length - PREFETCH_THRESHOLD- ) {- actions.loadMore()- }+ prefetchNearEnd()},dismissCurrent: () => {const report = values.currentReport@@ -404,6 +463,20 @@ export const inboxTriageLogic = kea<inboxTriageLogicType>([},})},+ unassignCurrent: () => {+ const report = values.currentReport+ if (!report || values.unassignDisabledReason) {+ return+ }+ // Only a list scoped to you drops the report, and only once the request succeeds. Pin+ // the next report by id, so triage lands on it whether or not this one leaves the queue.+ const next = values.nextReport+ actions.unassignMe(report.id, 'triage_mode')+ if (next) {+ actions.goToReport(next.id, values.currentIndex + 1)+ }+ prefetchNearEnd()+ },createPrForCurrent: () => {const report = values.currentReportif (!report || !values.canCreatePr || values.isCreatingPr || values.createPrDisabledReason) {@@ -442,6 +515,7 @@ export const inboxTriageLogic = kea<inboxTriageLogicType>([}return {setIndex: positionUrl,+ goToReport: positionUrl,removeReport: positionUrl,}}),diff --git a/products/signals/frontend/inbox/logics/reportListLogic.test.ts b/products/signals/frontend/inbox/logics/reportListLogic.test.tsindex b3df0d2e9d8a..09c927091f7b 100644--- a/products/signals/frontend/inbox/logics/reportListLogic.test.ts+++ b/products/signals/frontend/inbox/logics/reportListLogic.test.ts@@ -1,3 +1,5 @@+import { MOCK_USER_UUID } from 'lib/api.mock'+/* oxlint-disable react-hooks/rules-of-hooks -- useMocks is a test helper, not a React hook */import { expectLogic } from 'kea-test-utils'@@ -244,9 +246,16 @@ describe('reportListLogic', () => {after: [],dropped: false,},- ] as { name: string; scope: InboxScope; after: string[]; dropped: boolean }[])(+ {+ name: 'marks the row as yours once you are added',+ scope: INBOX_SCOPE_ENTIRE_PROJECT,+ after: [MOCK_USER_UUID],+ dropped: false,+ suggestedToMe: true,+ },+ ] as { name: string; scope: InboxScope; after: string[]; dropped: boolean; suggestedToMe?: boolean }[])('$name',- async ({ scope, after, dropped }) => {+ async ({ scope, after, dropped, suggestedToMe = false }) => {const bulkLogic = inboxBulkActionsLogic()bulkLogic.mount()logic.actions.setScope(scope)@@ -261,10 +270,39 @@ describe('reportListLogic', () => {const loadedCount = FIRST_PAGE.length + SECOND_PAGE.lengthexpect(logic.values.reports.map((r) => r.id).includes(FIRST_PAGE[3].id)).toBe(!dropped)expect(logic.values.reports).toHaveLength(dropped ? loadedCount - 1 : loadedCount)+ expect(logic.values.reports.find((r) => r.id === FIRST_PAGE[3].id)?.is_suggested_reviewer).toBe(+ dropped ? undefined : suggestedToMe+ )expect(requestedOffsets).toEqual([])bulkLogic.unmount()})++ it.each([+ { scope: INBOX_SCOPE_FOR_YOU, dropped: true },+ { scope: `teammate:${MOCK_USER_UUID}`, dropped: true },+ { scope: 'teammate:t-1', dropped: false },+ { scope: INBOX_SCOPE_ENTIRE_PROJECT, dropped: false },+ ] as { scope: InboxScope; dropped: boolean }[])(+ 'unassigning me under $scope drops the row: $dropped',+ async ({ scope, dropped }) => {+ const mine = FIRST_PAGE.map((r, i) => (i === 3 ? { ...r, is_suggested_reviewer: true } : r))+ useMocks({+ get: { [REPORTS_URL]: { count: mine.length, next: null, previous: null, results: mine } },+ })+ const bulkLogic = inboxBulkActionsLogic()+ bulkLogic.mount()+ logic.actions.setScope(scope)+ await expectLogic(logic).toFinishAllListeners()++ bulkLogic.actions.unassignedMe([mine[3].id])+ await expectLogic(logic).toFinishAllListeners()++ const row = logic.values.reports.find((r) => r.id === mine[3].id)+ expect(row ? row.is_suggested_reviewer : 'dropped').toEqual(dropped ? 'dropped' : false)+ bulkLogic.unmount()+ }+ )})// The list skips the ClickHouse source lookup so it renders from Postgres alone. The source linediff --git a/products/signals/frontend/inbox/logics/reportListLogic.ts b/products/signals/frontend/inbox/logics/reportListLogic.tsindex c8d9027578b5..0e7004f1889a 100644--- a/products/signals/frontend/inbox/logics/reportListLogic.ts+++ b/products/signals/frontend/inbox/logics/reportListLogic.ts@@ -15,6 +15,7 @@ import type { UserType } from '~/types'import {signalsReportsRefreshMetricsCreate,+ signalsReportsReviewersMeDestroy,signalsReportsSourceMetadataCreate,} from 'products/signals/frontend/generated/api'import type { SignalReportMetricSnapshotsApi } from 'products/signals/frontend/generated/api.schemas'@@ -179,6 +180,7 @@ export interface reportListLogicValues {activeSortDirection: InboxSortDirection // inboxFiltersLogicactiveSortField: InboxSortField // inboxFiltersLogichasUserChosenScope: boolean // inboxFiltersLogic+ isScopedToMe: boolean // inboxFiltersLogicpriorityFilter: SignalReportPriority[] // inboxFiltersLogicscope: InboxScope // inboxFiltersLogicscoutFilter: string[] // inboxFiltersLogic@@ -204,6 +206,7 @@ export interface reportListLogicValues {scopeReviewerUuid: string | undefinedstaleMetricReportIds: string[]totalCount: number | null+ unassigningReportIds: string[]}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -347,6 +350,23 @@ export interface reportListLogicActions {reportId: stringsurface: InboxReportActionSurface}+ setSuggestedToMe: (+ reportIds: string[],+ isSuggested: boolean+ ) => {+ isSuggested: boolean+ reportIds: string[]+ }+ unassignMe: (+ reportId: string,+ surface: InboxReportActionSurface+ ) => {+ reportId: string+ surface: InboxReportActionSurface+ }+ unassignMeFinished: (reportId: string) => {+ reportId: string+ }}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.@@ -408,6 +428,7 @@ export const reportListLogic = kea<reportListLogicType>([inboxFiltersLogic,['scope',+ 'isScopedToMe','hasUserChosenScope','searchQuery','activeSortField',@@ -451,6 +472,9 @@ export const reportListLogic = kea<reportListLogicType>([dismissReport: (reportId: string, dismissal: DismissalFeedback) => ({ reportId, dismissal }),resolveReport: (reportId: string, reason: ResolveReasonValue, note: string) => ({ reportId, reason, note }),restoreReport: (reportId: string, surface: InboxReportActionSurface) => ({ reportId, surface }),+ unassignMe: (reportId: string, surface: InboxReportActionSurface) => ({ reportId, surface }),+ unassignMeFinished: (reportId: string) => ({ reportId }),+ setSuggestedToMe: (reportIds: string[], isSuggested: boolean) => ({ reportIds, isSuggested }),removeReport: (reportId: string) => ({ reportId }),refresh: true,// Ask the server for the newest snapshot of the metrics these rows show. Best effort: a@@ -524,6 +548,13 @@ export const reportListLogic = kea<reportListLogicType>([})),reducers({+ unassigningReportIds: [+ [] as string[],+ {+ unassignMe: (state, { reportId }) => (state.includes(reportId) ? state : [...state, reportId]),+ unassignMeFinished: (state, { reportId }) => state.filter((id) => id !== reportId),+ },+ ],// Kept apart from `reportsResponse` so a refresh that replaces the rows does not blank the// source line while the lookup runs again.reportSourceMeta: [@@ -547,6 +578,18 @@ export const reportListLogic = kea<reportListLogicType>([count: Math.max(0, state.count - 1),}: state,+ setSuggestedToMe: (state, { reportIds, isSuggested }) => {+ const ids = new Set(reportIds)+ // Keep the same state when no row changes, so an unrelated edit does not re-render the list.+ return state?.results.some((r) => ids.has(r.id) && r.is_suggested_reviewer !== isSuggested)+ ? {+ ...state,+ results: state.results.map((r) =>+ ids.has(r.id) ? { ...r, is_suggested_reviewer: isSuggested } : r+ ),+ }+ : state+ },},count: {removeReport: (state) => (state != null ? Math.max(0, state - 1) : state),@@ -897,7 +940,36 @@ export const reportListLogic = kea<reportListLogicType>([const scopeUuid = values.scopeReviewerUuidif (scopeUuid && !reviewerUuids.includes(scopeUuid) && values.reports.some((r) => r.id === reportId)) {actions.removeReport(reportId)+ return+ }+ // Triage and the bulk bar offer Unassign me from this flag, so it follows the edit too.+ const userUuid = values.user?.uuid+ if (userUuid) {+ actions.setSuggestedToMe([reportId], reviewerUuids.includes(userUuid))+ }+ },+ [inboxBulkActionsLogic.actionTypes.unassignedMe]: ({ reportIds }: { reportIds: string[] }) => {+ if (values.isScopedToMe) {+ const loadedIds = new Set(values.reportsResponse?.results.map((r) => r.id))+ reportIds.filter((id) => loadedIds.has(id)).forEach((id) => actions.removeReport(id))+ } else {+ actions.setSuggestedToMe(reportIds, false)+ }+ },+ unassignMe: async ({ reportId, surface }) => {+ const report = values.reports.find((r) => r.id === reportId)+ captureInboxReportAction({ report, actionType: 'remove_suggested_reviewer', surface })+ try {+ await signalsReportsReviewersMeDestroy(String(values.currentTeamId), reportId)+ } catch (error: any) {+ lemonToast.error(error?.detail || "Couldn't unassign you from the report. Try again.")+ return+ } finally {+ actions.unassignMeFinished(reportId)}+ lemonToast.success('Unassigned you from the report')+ // The list that started the request can unmount while it runs, for example when triage closes.+ inboxBulkActionsLogic.findMounted()?.actions.unassignedMe([reportId])},})),diff --git a/products/signals/frontend/inbox/utils/reportActions.ts b/products/signals/frontend/inbox/utils/reportActions.tsindex 6e501d02306e..840a9082aeb2 100644--- a/products/signals/frontend/inbox/utils/reportActions.ts+++ b/products/signals/frontend/inbox/utils/reportActions.ts@@ -3,6 +3,15 @@ import { ACTIONABLE_ACTIONABILITY_VALUES, SignalReport, SignalReportStatus } fro// the list row context menu, so the surfaces cannot drift apart. Mirrors desktop `reportActions.ts`.import { primaryReportPullRequest, hasActiveReportPullRequest } from './reportPullRequests'+/**+ * Can the signed-in user take themselves off this report's suggested reviewers? A list scoped to them+ * holds only reports that name them, even where `is_suggested_reviewer` is false: the server clears+ * that flag on failed and not-actionable reports, which still list the user as a reviewer.+ */+export function canUnassignMe(report: SignalReport, isScopedToMe: boolean): boolean {+ return isScopedToMe || report.is_suggested_reviewer+}+/*** Should the Create PR action be offered? Mirrors desktop `canCreateImplementationPr` /* the server-side autostart rules: only when ready & actionable, or blocked on user input.