fix: chat duplication, lobby scroll, ban self-protection

- Chat: fix race condition where SSE delivers message before POST
  response, causing duplicate — now checks if real msg already exists
- LobbyManager: add max-h-72 + overflow-y-auto for long participant lists
- ModerationPanel: hide kick/ban buttons for yourself (useLocalParticipant),
  add max-h-80 + overflow scroll, show API errors instead of silencing
- Moderate API: reject kick/ban when targetSessionId === host userId
This commit is contained in:
2026-03-24 12:31:02 +03:00
parent f6d3f37a5f
commit 87f0b5a21d
4 changed files with 77 additions and 44 deletions

View File

@@ -45,6 +45,9 @@ export async function POST(
if (!targetSessionId) {
return NextResponse.json({ error: "targetSessionId required" }, { status: 400 });
}
if (targetSessionId === session.user.id) {
return NextResponse.json({ error: "Cannot kick yourself" }, { status: 400 });
}
await roomService.removeParticipant(lkRoom, targetSessionId);
await prisma.participantHistory.updateMany({
where: { roomId, sessionId: targetSessionId, leftAt: null },
@@ -57,6 +60,9 @@ export async function POST(
if (!targetSessionId) {
return NextResponse.json({ error: "targetSessionId required" }, { status: 400 });
}
if (targetSessionId === session.user.id) {
return NextResponse.json({ error: "Cannot ban yourself" }, { status: 400 });
}
// Find fingerprint from lobby entry or participant
const lobbyEntry = await prisma.lobbyEntry.findFirst({