* WIP block users * Add test to check if the person for user X is blocked or not * Added function isBlocked return true if user x is blocked by user y * Added block ans un block messages * Route / broadcast added ny Maix * notification block and un block with icon now works, started clean up * cleaning up the code * cleaning up the code - WIP * cleaning up the code - WIP * clean up code - WIP * clean up code - WIP * WIP block users * Add test to check if the person for user X is blocked or not * Added function isBlocked return true if user x is blocked by user y * Added block ans un block messages * REBASE -trying * REBASE trying * REBASE problems * REBASE problems * REBASE problems * MERGE problems * REBASE problem * REBASE problem * clean up code - WIP * MERGED master into nigel/blockUser * linter OK * TTT problem with package * Deletes tic tac and icons
18 lines
No EOL
548 B
TypeScript
18 lines
No EOL
548 B
TypeScript
import { __socket } from './chat';
|
|
import { updateUser } from "@app/auth";
|
|
|
|
export async function windowStateHidden() {
|
|
const socketId = __socket || undefined;
|
|
// let oldName = localStorage.getItem("oldName") ?? undefined;
|
|
let oldName: string;
|
|
if (socketId === undefined) return;
|
|
let userName = await updateUser();
|
|
oldName = userName?.name ?? "";
|
|
if (oldName === "") return;
|
|
localStorage.setItem('oldName', oldName);
|
|
socketId.emit('client_left', {
|
|
user: userName?.name,
|
|
why: 'tab window hidden - socket not dead',
|
|
});
|
|
return;
|
|
}; |