WIP block guest messages

This commit is contained in:
NigeParis 2026-01-07 18:24:07 +01:00 committed by Nigel
parent df192cf227
commit 01da8f4a9f

View file

@ -58,6 +58,7 @@ export async function sendPrivMessage(fastify: FastifyInstance, data: ClientMess
}
let blockMsgFlag: boolean = false;
const UserByID = getUserByName(allUsers, clientInfo.user) ?? '';
const userfiche: User | null = getUserByName(allUsers, clientInfo.user);
if (UserByID === '') {
return;
}
@ -72,6 +73,10 @@ export async function sendPrivMessage(fastify: FastifyInstance, data: ClientMess
if (socket.id === sender) {
continue;
}
if (!userfiche?.id) return;
const boolGuestMsg = fastify.db.getGuestMessage(userfiche?.id);
if (!boolGuestMsg&& userfiche.guest) continue;
if (!blockMsgFlag) {
socket.emit('MsgObjectServer', { message: data });
fastify.log.info({ senderID: `${UserID}`, msgPriv: data.text, target: `${UserByID.id}` });