mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-16 08:04:45 -04:00
fix(realtime): allow realtime user status updates from users that have read-only access
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
46330563fa
commit
d29e840bc6
4 changed files with 276 additions and 56 deletions
|
@ -20,12 +20,19 @@ export class ReceiveRemoteCursorViewPlugin implements PluginValue {
|
|||
this.listener = messageTransporter.on(
|
||||
MessageType.REALTIME_USER_STATE_SET,
|
||||
({ payload }) => {
|
||||
const cursors: RemoteCursor[] = payload.users.map((user) => ({
|
||||
from: user.cursor.from,
|
||||
to: user.cursor.to,
|
||||
displayName: user.displayName,
|
||||
styleIndex: user.styleIndex
|
||||
}))
|
||||
const cursors = payload.users
|
||||
.map((user) => {
|
||||
if (!user.cursor) {
|
||||
return undefined
|
||||
}
|
||||
return {
|
||||
from: user.cursor.from,
|
||||
to: user.cursor.to,
|
||||
displayName: user.displayName,
|
||||
styleIndex: user.styleIndex
|
||||
}
|
||||
})
|
||||
.filter((value) => value !== undefined) as RemoteCursor[]
|
||||
view.dispatch({
|
||||
effects: [remoteCursorUpdateEffect.of(cursors)]
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue