From 2cdc44b495b98ca09430a6f6266a5bea832245ea Mon Sep 17 00:00:00 2001 From: HotelSync Date: Tue, 14 Apr 2026 17:54:05 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20chat=20=E2=80=94=20group=20creation=20(s?= =?UTF-8?q?nake=5Fcase=20member=5Fids),=20readable=20mention=20color?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/routes/chat.ts | 7 ++++++- src/components/chat/ChatWidget.tsx | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/src/routes/chat.ts b/backend/src/routes/chat.ts index 05a30de..4200711 100644 --- a/backend/src/routes/chat.ts +++ b/backend/src/routes/chat.ts @@ -341,8 +341,13 @@ const chatRoutes: FastifyPluginAsync = async (fastify) => { const hotelId = await getHotelId(slug) if (!hotelId) return reply.code(404).send({ error: 'Hotel not found' }) - const { name, memberIds } = request.body + const name = request.body?.name + // Frontend sends snake_case (transformKeysToSnake converts camelCase) + const memberIds: string[] = Array.isArray((request.body as Record)?.member_ids) + ? (request.body as Record).member_ids as string[] + : Array.isArray(request.body?.memberIds) ? request.body.memberIds : [] if (!name?.trim()) return reply.code(400).send({ error: 'Name required' }) + if (memberIds.length === 0) return reply.code(400).send({ error: 'At least one member required' }) const userId = request.user.sub const allMembers = [...new Set([userId, ...memberIds])] diff --git a/src/components/chat/ChatWidget.tsx b/src/components/chat/ChatWidget.tsx index d23fad6..1cb4791 100644 --- a/src/components/chat/ChatWidget.tsx +++ b/src/components/chat/ChatWidget.tsx @@ -115,7 +115,7 @@ function renderWithMentions(text: string, myName?: string) { const mentioned = part.slice(1).toLowerCase() const isMe = myFirst && mentioned.startsWith(myFirst) return ( - + {part} )