PadMessageHandler: Inline unnecessary variables
Also delete some unneccessary comments.
This commit is contained in:
parent
7522d76c40
commit
f2a118b311
1 changed files with 4 additions and 16 deletions
|
@ -138,26 +138,16 @@ exports.handleDisconnect = async (socket) => {
|
||||||
` authorID:${session.author}` +
|
` authorID:${session.author}` +
|
||||||
(user && user.username ? ` username:${user.username}` : ''));
|
(user && user.username ? ` username:${user.username}` : ''));
|
||||||
/* eslint-enable prefer-template */
|
/* eslint-enable prefer-template */
|
||||||
|
socket.broadcast.to(session.padId).json.send({
|
||||||
// get the author color out of the db
|
|
||||||
const color = await authorManager.getAuthorColorId(session.author);
|
|
||||||
|
|
||||||
// prepare the notification for the other users on the pad, that this user left
|
|
||||||
const messageToTheOtherUsers = {
|
|
||||||
type: 'COLLABROOM',
|
type: 'COLLABROOM',
|
||||||
data: {
|
data: {
|
||||||
type: 'USER_LEAVE',
|
type: 'USER_LEAVE',
|
||||||
userInfo: {
|
userInfo: {
|
||||||
colorId: color,
|
colorId: await authorManager.getAuthorColorId(session.author),
|
||||||
userId: session.author,
|
userId: session.author,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
// Go through all user that are still on the pad, and send them the USER_LEAVE message
|
|
||||||
socket.broadcast.to(session.padId).json.send(messageToTheOtherUsers);
|
|
||||||
|
|
||||||
// Allow plugins to hook into users leaving the pad
|
|
||||||
hooks.callAll('userLeave', session);
|
hooks.callAll('userLeave', session);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -849,9 +839,7 @@ const handleClientReady = async (socket, message, authorID) => {
|
||||||
|
|
||||||
// get all authordata of this new user
|
// get all authordata of this new user
|
||||||
assert(authorID);
|
assert(authorID);
|
||||||
const value = await authorManager.getAuthor(authorID);
|
const {colorId: authorColorId, name: authorName} = await authorManager.getAuthor(authorID);
|
||||||
const authorColorId = value.colorId;
|
|
||||||
const authorName = value.name;
|
|
||||||
|
|
||||||
// load the pad-object from the database
|
// load the pad-object from the database
|
||||||
const pad = await padManager.getPad(padIds.padId);
|
const pad = await padManager.getPad(padIds.padId);
|
||||||
|
|
Loading…
Reference in a new issue