From c778afcbca777412e091890a49182b9be8301e8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Wed, 29 Apr 2020 23:18:42 +0200 Subject: [PATCH] Adding support for leaving the group if the socket is closed --- back/src/Model/World.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/back/src/Model/World.ts b/back/src/Model/World.ts index 06bcf884..795cc8be 100644 --- a/back/src/Model/World.ts +++ b/back/src/Model/World.ts @@ -34,7 +34,10 @@ export class World { } public leave(user : ExSocketInterface){ - /*TODO leaver user in group*/ + let userObj = this.users.get(user.id); + if (userObj !== undefined && typeof userObj.group !== 'undefined') { + this.leaveGroup(user); + } this.users.delete(user.userId); }