feat(user): added description and global guest user mute

This commit is contained in:
Maieul BOYER 2025-12-18 14:46:02 +01:00 committed by Maix0
parent bcba86ed8a
commit 556138d624
24 changed files with 1856 additions and 1460 deletions

View file

@ -27,7 +27,7 @@
"fastify": "^5.6.2",
"fastify-plugin": "^5.1.0",
"socket.io": "^4.8.1",
"typebox": "^1.0.63"
"typebox": "^1.0.64"
},
"devDependencies": {
"@types/node": "^22.19.3",

View file

@ -3,6 +3,7 @@ import type { ClientProfil } from './chat_types';
import type { User } from '@shared/database/mixin/user';
import { getUserByName } from './getUserByName';
import { Socket } from 'socket.io';
import { escape } from '@shared/utils';
/**
* function makeProfil - translates the Users[] to a one user looking by name
@ -13,7 +14,7 @@ import { Socket } from 'socket.io';
* @returns
*/
export async function makeProfil(fastify: FastifyInstance, user: string, socket: Socket): Promise <ClientProfil> {
export async function makeProfil(fastify: FastifyInstance, user: string, socket: Socket): Promise<ClientProfil> {
let clientProfil!: ClientProfil;
const users: User[] = fastify.db.getAllUsers() ?? [];
@ -29,7 +30,7 @@ export async function makeProfil(fastify: FastifyInstance, user: string, socket:
user: `${allUsers.name}`,
loginName: `${allUsers?.login ?? 'Guest'}`,
userID: `${allUsers?.id ?? ''}`,
text: '',
text: escape(allUsers.desc),
timestamp: Date.now(),
SenderWindowID: socket.id,
SenderName: '',
@ -38,4 +39,4 @@ export async function makeProfil(fastify: FastifyInstance, user: string, socket:
};
}
return clientProfil;
};
};