Cleanup; pretty

This commit is contained in:
PizZaKatZe 2021-12-18 11:30:58 +01:00
parent c96b65549f
commit 5c385c520a
5 changed files with 20 additions and 18 deletions

View file

@ -846,12 +846,13 @@ export class SocketManager {
handleFollowConfirmationMessage(room: GameRoom, user: User, message: FollowConfirmationMessage) {
const leader = room.getUserById(message.getLeader());
if (!leader) {
console.info('Could not find user "', message.getLeader(), '" while handling a follow confirmation in room "', room.roomUrl,'". Maybe the user just left.');
const message = `Could not follow user "{message.getLeader()}" in room "{room.roomUrl}".`;
console.info(message, "Maybe the user just left.");
return;
}
// By security, we look at the group leader. If the group leader is NOT the leader in the message, everybody should
// stop following the group leader (to avoid having 2 group leaders)
// By security, we look at the group leader. If the group leader is NOT the leader in the message,
// everybody should stop following the group leader (to avoid having 2 group leaders)
if (user?.group?.leader && user?.group?.leader !== leader) {
user?.group?.leader?.stopLeading();
}