toggle cmd for notifications blocage
This commit is contained in:
parent
ddfee11474
commit
581a2330de
1 changed files with 16 additions and 38 deletions
|
|
@ -48,6 +48,7 @@ export type obj =
|
||||||
};
|
};
|
||||||
|
|
||||||
const MAX_SYSTEM_MESSAGES = 10;
|
const MAX_SYSTEM_MESSAGES = 10;
|
||||||
|
let inviteMsgFlag: boolean = false;
|
||||||
|
|
||||||
// get the name of the machine used to connect
|
// get the name of the machine used to connect
|
||||||
const machineHostName = window.location.hostname;
|
const machineHostName = window.location.hostname;
|
||||||
|
|
@ -217,34 +218,6 @@ async function connected(socket: Socket): Promise<void> {
|
||||||
}, 16);
|
}, 16);
|
||||||
};
|
};
|
||||||
|
|
||||||
// async function whoami(socket: Socket) {
|
|
||||||
// try {
|
|
||||||
// const chatWindow = document.getElementById("t-chatbox") as HTMLDivElement;
|
|
||||||
// const loggedIn = isLoggedIn();
|
|
||||||
|
|
||||||
// const res = (getUser());
|
|
||||||
// console.log('loginGuest():', res?.name);
|
|
||||||
// if (res) {
|
|
||||||
// let user = await updateUser();
|
|
||||||
// if (chatWindow) {
|
|
||||||
// socket.emit('updateClientName', {
|
|
||||||
// oldUser: '',
|
|
||||||
// user: user?.name
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// if (user === null)
|
|
||||||
// return showError('Failed to get user: no user ?');
|
|
||||||
// setTitle(`Welcome ${user.guest ? '[GUEST] ' : ''}${user.name}`);
|
|
||||||
// } else {
|
|
||||||
// showError(`Failed to login: ${res}`);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// } catch (e) {
|
|
||||||
// console.error("Login error:", e);
|
|
||||||
// showError('Failed to login: Unknown error');
|
|
||||||
// }
|
|
||||||
// };
|
|
||||||
|
|
||||||
let count = 0;
|
let count = 0;
|
||||||
function incrementCounter(): number {
|
function incrementCounter(): number {
|
||||||
count += 1;
|
count += 1;
|
||||||
|
|
@ -388,13 +361,14 @@ function handleChat(_url: string, _args: RouteHandlerParams): RouteHandlerReturn
|
||||||
|
|
||||||
socket.on('blockUser', (blocked: ClientProfil) => {
|
socket.on('blockUser', (blocked: ClientProfil) => {
|
||||||
let icon = '⛔';
|
let icon = '⛔';
|
||||||
|
if (inviteMsgFlag) {
|
||||||
const chatWindow = document.getElementById("t-chatbox") as HTMLDivElement;
|
const chatWindow = document.getElementById("t-chatbox") as HTMLDivElement;
|
||||||
const messageElement = document.createElement("div");
|
const messageElement = document.createElement("div");
|
||||||
if (`${blocked.text}` === 'I have un-blocked you' ) {icon = '💚'};
|
if (`${blocked.text}` === 'I have un-blocked you' ) {icon = '💚'};
|
||||||
messageElement.innerText =`${icon}${blocked.SenderName}: ${blocked.text}`;
|
messageElement.innerText =`${icon}${blocked.SenderName}: ${blocked.text}`;
|
||||||
chatWindow.appendChild(messageElement);
|
chatWindow.appendChild(messageElement);
|
||||||
chatWindow.scrollTop = chatWindow.scrollHeight;
|
chatWindow.scrollTop = chatWindow.scrollHeight;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -521,9 +495,13 @@ function handleChat(_url: string, _args: RouteHandlerParams): RouteHandlerReturn
|
||||||
case '@msg':
|
case '@msg':
|
||||||
broadcastMsg(socket, msgCommand);
|
broadcastMsg(socket, msgCommand);
|
||||||
break;
|
break;
|
||||||
// case '@who':
|
case '@notify':
|
||||||
// whoami(socket);
|
if (inviteMsgFlag === false) {
|
||||||
// break;
|
inviteMsgFlag = true;
|
||||||
|
} else {
|
||||||
|
inviteMsgFlag = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case '@profil':
|
case '@profil':
|
||||||
getProfil(socket, msgCommand[1]);
|
getProfil(socket, msgCommand[1]);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue