From c96b65549f92de55652d427aa81eda16a684f7ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Fri, 17 Dec 2021 18:29:52 +0100 Subject: [PATCH] Performing proper cleanup when a user leaves --- back/src/Model/GameRoom.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/back/src/Model/GameRoom.ts b/back/src/Model/GameRoom.ts index 07b611e8..9b0fef45 100644 --- a/back/src/Model/GameRoom.ts +++ b/back/src/Model/GameRoom.ts @@ -154,6 +154,14 @@ export class GameRoom { if (userObj !== undefined && typeof userObj.group !== "undefined") { this.leaveGroup(userObj); } + + if (user.hasFollowers()) { + user.stopLeading(); + } + if (user.following) { + user.following.delFollower(user); + } + this.users.delete(user.id); this.usersByUuid.delete(user.uuid);