mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
PadMessageHandler: Invert condition to improve readability
This commit is contained in:
parent
a3b4d985ac
commit
7522d76c40
1 changed files with 31 additions and 39 deletions
|
@ -126,13 +126,9 @@ exports.kickSessionsFromPad = (padID) => {
|
||||||
*/
|
*/
|
||||||
exports.handleDisconnect = async (socket) => {
|
exports.handleDisconnect = async (socket) => {
|
||||||
stats.meter('disconnects').mark();
|
stats.meter('disconnects').mark();
|
||||||
|
|
||||||
// save the padname of this session
|
|
||||||
const session = sessioninfos[socket.id];
|
const session = sessioninfos[socket.id];
|
||||||
|
delete sessioninfos[socket.id];
|
||||||
// if this connection was already etablished with a handshake,
|
if (!session || !session.author) return;
|
||||||
// send a disconnect message to the others
|
|
||||||
if (session && session.author) {
|
|
||||||
const {session: {user} = {}} = socket.client.request;
|
const {session: {user} = {}} = socket.client.request;
|
||||||
/* eslint-disable prefer-template -- it doesn't support breaking across multiple lines */
|
/* eslint-disable prefer-template -- it doesn't support breaking across multiple lines */
|
||||||
accessLogger.info('[LEAVE]' +
|
accessLogger.info('[LEAVE]' +
|
||||||
|
@ -163,10 +159,6 @@ exports.handleDisconnect = async (socket) => {
|
||||||
|
|
||||||
// Allow plugins to hook into users leaving the pad
|
// Allow plugins to hook into users leaving the pad
|
||||||
hooks.callAll('userLeave', session);
|
hooks.callAll('userLeave', session);
|
||||||
}
|
|
||||||
|
|
||||||
// Delete the sessioninfos entrys of this session
|
|
||||||
delete sessioninfos[socket.id];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue