diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-09 17:33:28 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-10-09 17:33:28 +0200 |
commit | da030aaff2ca77395d0ca7a39e5ca4f7abfc23cd (patch) | |
tree | 2f47154dba040ce951f0a218cd209a504c4ed29a /gateway | |
parent | :sparkles: handleFile() now returns mime_type and size (diff) | |
download | server-da030aaff2ca77395d0ca7a39e5ca4f7abfc23cd.tar.xz |
:sparkles: added read state
Diffstat (limited to 'gateway')
-rw-r--r-- | gateway/src/opcodes/Identify.ts | 11 |
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, }, |