summary refs log tree commit diff
path: root/api/src/routes/channels
diff options
context:
space:
mode:
authorChris Chrome <christophercookman@gmail.com>2021-09-20 11:29:37 -0400
committerChris Chrome <christophercookman@gmail.com>2021-09-20 11:29:37 -0400
commitcb83f11ca43e5baa16a38eafc54b0616cd770d82 (patch)
treea9dacf994eeeabf0fd80e4f5d209ae818c0ab78e /api/src/routes/channels
parentDelete messages before deleting channel (diff)
downloadserver-cb83f11ca43e5baa16a38eafc54b0616cd770d82.tar.xz
Fix one thing, another problem pops up
Co-authored-by: TheArcaneBrony <myrainbowdash949@gmail.com>
Diffstat (limited to 'api/src/routes/channels')
-rw-r--r--api/src/routes/channels/#channel_id/index.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/api/src/routes/channels/#channel_id/index.ts b/api/src/routes/channels/#channel_id/index.ts

index ca8cc87c..9a3cb4c2 100644 --- a/api/src/routes/channels/#channel_id/index.ts +++ b/api/src/routes/channels/#channel_id/index.ts
@@ -1,4 +1,4 @@ -import { Channel, Message, ChannelDeleteEvent, ChannelPermissionOverwriteType, ChannelType, ChannelUpdateEvent, emitEvent, Recipient } from "@fosscord/util"; +import { Channel, Message, Invite, ReadState, ChannelDeleteEvent, ChannelPermissionOverwriteType, ChannelType, ChannelUpdateEvent, emitEvent, Recipient } from "@fosscord/util"; import { Request, Response, Router } from "express"; import { handleFile, route } from "@fosscord/api"; @@ -32,6 +32,9 @@ router.delete("/", route({ permission: "MANAGE_CHANNELS" }), async (req: Request } else { await Promise.all([ Message.delete({ channel_id: channel_id }), + Invite.delete({ channel_id: channel_id }), + Recipient.delete({ channel_id: channel_id }), + ReadState.delete({ channel_id: channel_id }), Channel.delete({ id: channel_id }), emitEvent({ event: "CHANNEL_DELETE", data: channel, channel_id } as ChannelDeleteEvent) ]);