Users blocking now rely on UUID rather than ID

This way, if a user A blocks another user B, if user B refreshes the browser or leaves and re-enters the room, user B will still be blocked.
As a side effect, this allows us to completely remove the "sockets" property in the SocketManager on the Pusher.
This commit is contained in:
David Négrier 2021-07-07 11:24:51 +02:00
parent 28e4f59e50
commit 34cb0ebf39
15 changed files with 143 additions and 141 deletions

View file

@ -1,6 +1,6 @@
import { writable } from "svelte/store";
import type {PlayerInterface} from "../Phaser/Game/PlayerInterface";
import type {RoomConnection} from "../Connexion/RoomConnection";
import type { PlayerInterface } from "../Phaser/Game/PlayerInterface";
import type { RoomConnection } from "../Connexion/RoomConnection";
/**
* A store that contains the list of players currently known.
@ -23,6 +23,7 @@ function createPlayersStore() {
characterLayers: message.characterLayers,
visitCardUrl: message.visitCardUrl,
companion: message.companion,
userUuid: message.userUuid,
});
return users;
});
@ -34,9 +35,9 @@ function createPlayersStore() {
});
});
},
getPlayerById(userId: number): PlayerInterface|undefined {
getPlayerById(userId: number): PlayerInterface | undefined {
return players.get(userId);
}
},
};
}