PadMessageHandler: Don't fire `userLeave` if user hasn't joined yet

This commit is contained in:
Richard Hansen 2021-11-07 01:30:39 -04:00
parent 87a490d456
commit caefd2184a
1 changed files with 2 additions and 1 deletions

View File

@ -131,7 +131,8 @@ exports.handleDisconnect = async (socket) => {
stats.meter('disconnects').mark();
const session = sessioninfos[socket.id];
delete sessioninfos[socket.id];
if (!session || !session.author) return;
// session.padId can be nullish if the user disconnects before sending CLIENT_READY.
if (!session || !session.author || !session.padId) return;
const {session: {user} = {}} = socket.client.request;
/* eslint-disable prefer-template -- it doesn't support breaking across multiple lines */
accessLogger.info('[LEAVE]' +