fix(forum): complete member profiles — counts, avatars, strip AI metadata

This commit is contained in:
2026-06-26 23:46:59 +00:00
parent 4acc068732
commit eb05918960
7 changed files with 133 additions and 81 deletions

View File

@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from 'next/server';
import { createClient } from '@/lib/supabase/server';
import { attachAuthorUsernames, buildAuthorUsernameMap } from '@/lib/forum/authorUsernames';
export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) {
try {
@@ -30,7 +31,13 @@ export async function GET(req: NextRequest, { params }: { params: Promise<{ id:
if (repliesError) throw repliesError;
return NextResponse.json({ thread, replies: replies || [] });
const usernameMap = await buildAuthorUsernameMap(supabase);
const [threadWithUsername] = attachAuthorUsernames([thread], usernameMap);
return NextResponse.json({
thread: threadWithUsername,
replies: attachAuthorUsernames(replies, usernameMap),
});
} catch (err: any) {
return NextResponse.json({ error: err.message }, { status: 500 });
}