Skip to content

Commit a7a4b38

Browse files
authored
Merge pull request #25 from oslabs-beta/liz-canvasbug
Bug fix in canvas cleaning
2 parents d6729c0 + 5aa4342 commit a7a4b38

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

server/server.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,12 @@ io.on('connection', (client) => {
248248
});
249249

250250
client.on('clearCanvasAction', async (roomCode: string, userName: string) => {
251+
const usernNames = Object.values(roomLists[roomCode]).map(
252+
(el) => el['userName']
253+
);
251254
if (roomCode) {
252255
// server send clear canvas to everyone in the room if action is from the host
253-
if (userName === Object.values(roomLists[roomCode])[0]) {
256+
if (userName === usernNames[0]) {
254257
io.to(roomCode).emit(
255258
'clear canvas from server',
256259
Object.values(roomLists[roomCode])

0 commit comments

Comments
 (0)