PadMessageHandler: Invert condition to improve readability
parent
a3b4d985ac
commit
7522d76c40
|
@ -126,13 +126,9 @@ exports.kickSessionsFromPad = (padID) => {
|
|||
*/
|
||||
exports.handleDisconnect = async (socket) => {
|
||||
stats.meter('disconnects').mark();
|
||||
|
||||
// save the padname of this session
|
||||
const session = sessioninfos[socket.id];
|
||||
|
||||
// if this connection was already etablished with a handshake,
|
||||
// send a disconnect message to the others
|
||||
if (session && session.author) {
|
||||
delete sessioninfos[socket.id];
|
||||
if (!session || !session.author) return;
|
||||
const {session: {user} = {}} = socket.client.request;
|
||||
/* eslint-disable prefer-template -- it doesn't support breaking across multiple lines */
|
||||
accessLogger.info('[LEAVE]' +
|
||||
|
@ -163,10 +159,6 @@ exports.handleDisconnect = async (socket) => {
|
|||
|
||||
// Allow plugins to hook into users leaving the pad
|
||||
hooks.callAll('userLeave', session);
|
||||
}
|
||||
|
||||
// Delete the sessioninfos entrys of this session
|
||||
delete sessioninfos[socket.id];
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue