mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-09 20:22:47 +01:00
Gateway close if user could not be fetched just send ID
This commit is contained in:
parent
6dc9dd5303
commit
271460b02f
@ -54,11 +54,19 @@ export async function Close(this: WebSocket, code: number, reason: Buffer) {
|
||||
status: "offline",
|
||||
};
|
||||
|
||||
// TODO
|
||||
// If a user was deleted, they may still be connected to gateway,
|
||||
// which will cause this to throw when they disconnect.
|
||||
// just send the ID of the user instead of the full correct payload for now
|
||||
const userOrId = await User.getPublicUser(this.user_id).catch(() => ({
|
||||
id: this.user_id,
|
||||
}));
|
||||
|
||||
await emitEvent({
|
||||
event: "PRESENCE_UPDATE",
|
||||
user_id: this.user_id,
|
||||
data: {
|
||||
user: await User.getPublicUser(this.user_id),
|
||||
user: userOrId,
|
||||
activities: session.activities,
|
||||
client_status: session?.client_info,
|
||||
status: session.status,
|
||||
|
Loading…
Reference in New Issue
Block a user