mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-18 17:25:16 -04:00
realtime.ts: Fix bug in user-color setup
The code was incorrectly migrated from JavaScript set colors in the wrong way. Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
parent
5c4820483c
commit
d2963eedc6
1 changed files with 14 additions and 9 deletions
|
@ -467,16 +467,21 @@ function finishConnection (socket: SocketWithNoteId, noteId: string, socketId: s
|
||||||
return failConnection(403, 'connection forbidden', socket)
|
return failConnection(403, 'connection forbidden', socket)
|
||||||
}
|
}
|
||||||
const user = users.get(socketId)
|
const user = users.get(socketId)
|
||||||
if (!user || !user.userid) return
|
if (!user) {
|
||||||
// update user color to author color
|
logger.warn('Could not find user for socketId ' + socketId)
|
||||||
const author = note.authors.get(user.userid)
|
return
|
||||||
if (author) {
|
}
|
||||||
const socketIdUser = users.get(socket.id)
|
if (user.userid) {
|
||||||
if (!socketIdUser) return
|
// update user color to author color
|
||||||
user.color = socketIdUser.color
|
const author = note.authors.get(user.userid)
|
||||||
users.set(socket.id, user)
|
if (author) {
|
||||||
|
const socketIdUser = users.get(socket.id)
|
||||||
|
if (!socketIdUser) return
|
||||||
|
user.color = author.color
|
||||||
|
socketIdUser.color = author.color
|
||||||
|
users.set(socket.id, user)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
note.users.set(socket.id, user)
|
note.users.set(socket.id, user)
|
||||||
note.socks.push(socket)
|
note.socks.push(socket)
|
||||||
note.server.addClient(socket)
|
note.server.addClient(socket)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue