summary refs log tree commit diff
path: root/gateway
diff options
context:
space:
mode:
authoruurgothat <cckhmck@gmail.com>2021-10-09 18:44:46 +0300
committeruurgothat <cckhmck@gmail.com>2021-10-09 18:44:46 +0300
commit09c3d7a560d536391d17a085c9c908aa5dcfec05 (patch)
tree928a97b088b18ff1afba76f9b71362c2dc4b23f9 /gateway
parentImplement GIFs (diff)
parent:sparkles: added read state (diff)
downloadserver-09c3d7a560d536391d17a085c9c908aa5dcfec05.tar.xz
Merge branch 'master' of https://github.com/fosscord/fosscord-server
Diffstat (limited to '')
-rw-r--r--gateway/src/opcodes/Identify.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/gateway/src/opcodes/Identify.ts b/gateway/src/opcodes/Identify.ts

index 6decf21c..b81c7bf4 100644 --- a/gateway/src/opcodes/Identify.ts +++ b/gateway/src/opcodes/Identify.ts
@@ -11,6 +11,7 @@ import { PublicMember, PublicUser, PrivateUserProjection, + ReadState, } from "@fosscord/util"; import { Send } from "../util/Send"; import { CLOSECODES, OPCODES } from "../util/Constants"; @@ -138,6 +139,13 @@ export async function onIdentify(this: WebSocket, data: Payload) { //We save the session and we delete it when the websocket is closed await session.save(); + const read_states = await ReadState.find({ user_id: this.user_id }); + read_states.forEach((s: any) => { + s.id = s.channel_id; + delete s.user_id; + delete s.channel_id; + }); + const privateUser = { avatar: user.avatar, mobile: user.mobile, @@ -176,8 +184,7 @@ export async function onIdentify(this: WebSocket, data: Payload) { geo_ordered_rtc_regions: [], // TODO relationships: user.relationships.map((x) => x.toPublicRelationship()), read_state: { - // TODO - entries: [], + entries: read_states, partial: false, version: 304128, },