Skip to content

Commit 27710a9

Browse files
kalvinnchaunpub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7npub122y0pqkertljmedu303rl0aqrj3w8pvu43t6jxm6875lzg6f2pwqegc3xc
authored
feat(admin): show reported message content in report detail (#3149)
## Summary - include the reported event's complete stored content, author, creation time, and deletion state in the admin report detail response - resolve the event through a community-scoped join so an event ID collision cannot cross tenant boundaries - render the message only on report detail, with an explicit unavailable state when retention has removed it - preserve the existing report list contract so message bodies are not returned during queue browsing ## Security - the existing admin host/origin authorization runs before the detail database read; a route test pins that ordering - the target event is selected using both `events.community_id = moderation_reports.community_id` and `events.id = moderation_reports.target_event_id` - the client supplies only the report UUID; it cannot choose a community or arbitrary event ID - soft-deleted content is visible only through this restricted admin detail route and is labeled deleted - responses retain the admin API's `no-store`, CSP, `nosniff`, frame denial, and referrer policy middleware ## Testing - `pnpm -C admin-web check` - `pnpm -C admin-web test:e2e` (10 passed) - `cargo test -p buzz-db` (84 passed, 130 ignored) - `cargo clippy -p buzz-db -p buzz-relay --all-targets -- -D warnings` - focused admin authorization tests - pre-push Rust and desktop/Tauri suites passed The new Postgres integration test is ignored under the repository convention and will run when explicitly enabled against migrated Postgres. Local Postgres and Redis were unavailable, so the full `buzz-relay --lib` run had 8 existing infrastructure-dependent failures after 749 tests passed. --------- Signed-off-by: npub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7 <6e30cd56c30e030cd31bb0939b94a7c257c9a09d5ba2d92cf2735da45629f248@buzz.block.builderlab.xyz> Signed-off-by: Kalvin Chau <[email protected]> Signed-off-by: npub122y0pqkertljmedu303rl0aqrj3w8pvu43t6jxm6875lzg6f2pwqegc3xc <5288f082d91aff2de5bc8be23fbfa01ca2e3859cac57a91b7a3fa9f12349505c@buzz.block.builderlab.xyz> Co-authored-by: npub1dccv64krpcpse5cmkzfeh998cftungyatw3djt8jwdw6g43f7fyqzzmrf7 <6e30cd56c30e030cd31bb0939b94a7c257c9a09d5ba2d92cf2735da45629f248@buzz.block.builderlab.xyz> Co-authored-by: npub122y0pqkertljmedu303rl0aqrj3w8pvu43t6jxm6875lzg6f2pwqegc3xc <5288f082d91aff2de5bc8be23fbfa01ca2e3859cac57a91b7a3fa9f12349505c@buzz.block.builderlab.xyz>
1 parent 8ed3e30 commit 27710a9

7 files changed

Lines changed: 439 additions & 8 deletions

File tree

‎admin-web/src/App.tsx‎

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import {
77
useState,
88
} from "react";
99
import { ApiFailure, request } from "./api";
10-
import type { FeedbackDetail, FeedbackSummary, Report } from "./types";
10+
import type {
11+
FeedbackDetail,
12+
FeedbackSummary,
13+
Report,
14+
ReportDetail as ReportDetailData,
15+
} from "./types";
1116
import { useResource } from "./useResource";
1217

1318
function usePath() {
@@ -131,7 +136,10 @@ function Reports() {
131136
}
132137

133138
function ReportDetail({ id }: { id: string }) {
134-
const resource = useResource(() => request<Report>(`/reports/${id}`), id);
139+
const resource = useResource(
140+
() => request<ReportDetailData>(`/reports/${id}`),
141+
id,
142+
);
135143
return (
136144
<Page
137145
eyebrow="Moderation"
@@ -164,6 +172,32 @@ function ReportDetail({ id }: { id: string }) {
164172
<dd>
165173
<code>{report.target}</code>
166174
</dd>
175+
{report.targetKind === "event" ? (
176+
<>
177+
<dt>Message</dt>
178+
<dd>
179+
{report.message ? (
180+
<div className="reported-message">
181+
{report.message.deletedAt ? (
182+
<span className="status">Deleted</span>
183+
) : null}
184+
<p>{report.message.content}</p>
185+
<div className="reported-message-meta">
186+
<span>Author</span>
187+
<code>{report.message.authorPubkey}</code>
188+
<span>Created</span>
189+
<time>{date(report.message.createdAt)}</time>
190+
</div>
191+
</div>
192+
) : (
193+
<p className="message-unavailable">
194+
Message content is unavailable. It may have expired or
195+
been removed from event storage.
196+
</p>
197+
)}
198+
</dd>
199+
</>
200+
) : null}
167201
<dt>Note</dt>
168202
<dd className="sensitive">
169203
{report.note ?? "No note provided."}

‎admin-web/src/styles.css‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,38 @@ dd {
496496
margin: 0;
497497
}
498498

499+
.reported-message {
500+
display: grid;
501+
justify-items: start;
502+
gap: 1rem;
503+
border-left: 3px solid #d7d72e;
504+
border-radius: 0 0.8rem 0.8rem 0;
505+
background: #f6f6f1;
506+
padding: 1rem;
507+
}
508+
509+
.reported-message p,
510+
.message-unavailable {
511+
margin: 0;
512+
overflow-wrap: anywhere;
513+
line-height: 1.5;
514+
white-space: pre-wrap;
515+
}
516+
517+
.reported-message-meta {
518+
display: grid;
519+
grid-template-columns: auto minmax(0, 1fr);
520+
gap: 0.4rem 0.75rem;
521+
width: 100%;
522+
color: rgb(35 30 30 / 48%);
523+
font-size: 0.78rem;
524+
}
525+
526+
.message-unavailable {
527+
color: rgb(35 30 30 / 60%);
528+
font-style: italic;
529+
}
530+
499531
.sensitive {
500532
border-left: 3px solid #d7d72e;
501533
border-radius: 0 0.8rem 0.8rem 0;

‎admin-web/src/types.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ export interface Report {
1212
createdAt: string;
1313
}
1414

15+
export interface ReportedMessage {
16+
authorPubkey: string;
17+
content: string;
18+
createdAt: string;
19+
deletedAt: string | null;
20+
}
21+
22+
export interface ReportDetail extends Report {
23+
message: ReportedMessage | null;
24+
}
25+
1526
export interface FeedbackSummary {
1627
id: string;
1728
communityId: string;

‎admin-web/tests/routes.spec.ts‎

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,72 @@ test("report rows render the relay response contract", async ({ page }) => {
5858
await expect(page.getByText("Unknown date")).toHaveCount(0);
5959
});
6060

61+
test("event report detail renders the reported message content", async ({
62+
page,
63+
}) => {
64+
const id = "0e6caad8-1e18-4cd7-84fa-7264103f0a08";
65+
await page.route(`**/api/admin/v1/reports/${id}`, (route) =>
66+
route.fulfill({
67+
contentType: "application/json",
68+
body: JSON.stringify({
69+
id,
70+
communityId: "6d474feb-c50a-44e4-a0b5-f30532df49bc",
71+
communityHost: "design.buzz.xyz",
72+
reporterPubkey: "21".repeat(32),
73+
targetKind: "event",
74+
target: "12".repeat(32),
75+
reportType: "spam",
76+
status: "open",
77+
createdAt: "2026-07-17T17:30:00Z",
78+
message: {
79+
authorPubkey: "31".repeat(32),
80+
content:
81+
"This is the complete reported message.\nIt preserves lines.",
82+
createdAt: "2026-07-17T17:25:00Z",
83+
deletedAt: null,
84+
},
85+
}),
86+
}),
87+
);
88+
89+
await page.goto(`/reports/${id}`);
90+
await expect(
91+
page.getByText("This is the complete reported message.", { exact: false }),
92+
).toBeVisible();
93+
await expect(page.getByText("31".repeat(32))).toBeVisible();
94+
await expect(
95+
page.getByText("Message content is unavailable", { exact: false }),
96+
).toHaveCount(0);
97+
});
98+
99+
test("event report detail explains when message content is unavailable", async ({
100+
page,
101+
}) => {
102+
const id = "0e6caad8-1e18-4cd7-84fa-7264103f0a09";
103+
await page.route(`**/api/admin/v1/reports/${id}`, (route) =>
104+
route.fulfill({
105+
contentType: "application/json",
106+
body: JSON.stringify({
107+
id,
108+
communityId: "6d474feb-c50a-44e4-a0b5-f30532df49bc",
109+
communityHost: "design.buzz.xyz",
110+
reporterPubkey: "21".repeat(32),
111+
targetKind: "event",
112+
target: "12".repeat(32),
113+
reportType: "spam",
114+
status: "open",
115+
createdAt: "2026-07-17T17:30:00Z",
116+
message: null,
117+
}),
118+
}),
119+
);
120+
121+
await page.goto(`/reports/${id}`);
122+
await expect(
123+
page.getByText("Message content is unavailable", { exact: false }),
124+
).toBeVisible();
125+
});
126+
61127
test("feedback cards open the complete submission", async ({ page }) => {
62128
const id = "feed0000-0000-4000-8000-000000000001";
63129
const fullBody = `${"Long feedback ".repeat(30)}end of feedback`;

0 commit comments

Comments
 (0)