Skip to content

Commit 4d4b2a8

Browse files
authored
Redirect resolved reports to Archive and hide their Restore action
Adding `resolved` to INBOX_EXCLUDED_STATUSES left two gaps for resolved (merged-PR) reports: - InboxReportDetailGate's stale-URL redirect only checked `suppressed`, so a resolved report opened at a /pulls, /reports, or /runs URL rendered full triage actions instead of redirecting to Archive. Switch to the isDismissedReport predicate (suppressed OR resolved) so both terminal states redirect symmetrically. - DismissedReportDetail always rendered Restore; resolved reports are terminal, so gate it with isResolvedReport — matching the list-card behavior. Per Greptile review. Generated-By: PostHog Code Task-Id: 3a7dec81-6f1d-425a-a7cb-f468c36b3ec7
1 parent 70ebd35 commit 4d4b2a8

2 files changed

Lines changed: 22 additions & 17 deletions

File tree

packages/ui/src/features/inbox/components/DismissedReportDetail.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
FileTextIcon,
55
MagnifyingGlassIcon,
66
} from "@phosphor-icons/react";
7+
import { isResolvedReport } from "@posthog/core/inbox/reportMembership";
78
import { Button } from "@posthog/quill";
89
import type { SignalReport } from "@posthog/shared/types";
910
import { InboxDetailFrame } from "@posthog/ui/features/inbox/components/InboxDetailFrame";
@@ -19,14 +20,15 @@ interface DismissedReportDetailProps {
1920
}
2021

2122
/**
22-
* Detail view for an archived (suppressed) report. Read-only re-read of what the
23-
* report was — summary + evidence — with a single Restore action. No triage
24-
* affordances (archive, discuss, create PR, reviewers): the report is out of the
25-
* pipeline until it's restored.
23+
* Detail view for an archived report. Read-only re-read of what the report was —
24+
* summary + evidence. Suppressed reports get a single Restore action; resolved
25+
* reports (their PR merged) are terminal and shown for reference only, with no
26+
* Restore. No triage affordances (archive, discuss, create PR, reviewers): the
27+
* report is out of the pipeline.
2628
*
2729
* The gate keeps reports on the route that matches their status: a no-longer-
28-
* suppressed report opened here (stale URL or restored elsewhere) is redirected
29-
* to its current home, so this content only ever renders a suppressed report.
30+
* archived report opened here (stale URL or restored elsewhere) is redirected to
31+
* its current home, so this content only ever renders an archived report.
3032
*/
3133
export function DismissedReportDetail({
3234
reportId,
@@ -55,7 +57,8 @@ function DismissedReportDetailContent({ report }: { report: SignalReport }) {
5557
showDismiss={false}
5658
primaryAction={
5759
<>
58-
<RestoreReportButton report={report} />
60+
{/* Resolved reports are terminal (PR merged) — no Restore. */}
61+
{!isResolvedReport(report) && <RestoreReportButton report={report} />}
5962
<Button
6063
type="button"
6164
variant="outline"

packages/ui/src/features/inbox/components/InboxReportDetailGate.tsx

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
isDismissedReport,
23
isNotActionableReport,
34
isPullRequestReport,
45
isReportTabReport,
@@ -75,21 +76,22 @@ export function InboxReportDetailGate({
7576

7677
// Keep the report on the route that matches its status. A status↔route mismatch
7778
// happens when a URL goes stale — browser history, a bookmark, a copied deep
78-
// link, or a status change in another session. A suppressed report reached via a
79-
// /pulls, /reports, or /runs URL would otherwise render that tab's full triage
80-
// actions (archive, discuss, create PR) on an out-of-pipeline report; a restored
81-
// report reached via /dismissed would offer Restore and silently re-queue it
82-
// (READY/RESOLVED → POTENTIAL is an allowed server-side transition). Redirect
83-
// across that dismissed↔pipeline boundary, gated on a settled fetch so we act on
84-
// the confirmed status rather than a pre-change cache snapshot (the detail query
79+
// link, or a status change in another session. An archived report (suppressed,
80+
// or resolved once its PR merges) reached via a /pulls, /reports, or /runs URL
81+
// would otherwise render that tab's full triage actions (archive, discuss,
82+
// create PR) on an out-of-pipeline report; a restored report reached via
83+
// /dismissed would offer Restore and silently re-queue it (READY/RESOLVED →
84+
// POTENTIAL is an allowed server-side transition). Redirect across that
85+
// archive↔pipeline boundary, gated on a settled fetch so we act on the
86+
// confirmed status rather than a pre-change cache snapshot (the detail query
8587
// forces a fresh fetch on mount via `initialDataUpdatedAt: 0`).
8688
const onDismissedRoute = backTo === "/code/inbox/dismissed";
87-
const isSuppressed = resolvedReport?.status === "suppressed";
89+
const isArchived = resolvedReport ? isDismissedReport(resolvedReport) : false;
8890
let redirectTo: InboxDetailRoute | null = null;
8991
if (resolvedReport && !isFetching) {
90-
if (isSuppressed && !onDismissedRoute) {
92+
if (isArchived && !onDismissedRoute) {
9193
redirectTo = "/code/inbox/dismissed/$reportId";
92-
} else if (!isSuppressed && onDismissedRoute) {
94+
} else if (!isArchived && onDismissedRoute) {
9395
redirectTo = nonSuppressedDetailRoute(resolvedReport);
9496
}
9597
}

0 commit comments

Comments
 (0)