fix: use correct super_admin role in group ownership transfer check

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-17 11:50:07 +03:00
parent 18a6359adb
commit ea58cffa88

View File

@@ -417,7 +417,7 @@ const chatRoutes: FastifyPluginAsync = async (fastify) => {
// Transfer ownership (only current owner or admin can do this)
if (transferOwnerTo) {
const userId = request.user.sub
if (createdBy !== userId && request.user.role !== 'admin') {
if (createdBy !== userId && request.user.role !== 'super_admin') {
return reply.code(403).send({ error: 'Only the group creator can transfer ownership' })
}
await db.query('UPDATE chat_rooms SET created_by = $1 WHERE id = $2', [transferOwnerTo, roomId])