diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-09-20 18:34:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-20 18:34:13 +0200 |
commit | 3151e904484feeaffd4eb67bfb978591957c3c13 (patch) | |
tree | 38f774cfae5f41b831d043c6e46855ec14e2ad15 | |
parent | Merge branch 'master' of https://github.com/fosscord/fosscord-api (diff) | |
parent | Update index.ts (diff) | |
download | server-3151e904484feeaffd4eb67bfb978591957c3c13.tar.xz |
Merge pull request #386 from ChrisChrome/master
Delete messages before deleting channel
-rw-r--r-- | api/src/routes/channels/#channel_id/index.ts | 1 | ||||
-rw-r--r-- | api/src/routes/users/@me/relationships.ts | 2 | ||||
-rw-r--r-- | api/src/util/route.ts | 1 |
3 files changed, 2 insertions, 2 deletions
diff --git a/api/src/routes/channels/#channel_id/index.ts b/api/src/routes/channels/#channel_id/index.ts index 3f434f5e..fde75ec9 100644 --- a/api/src/routes/channels/#channel_id/index.ts +++ b/api/src/routes/channels/#channel_id/index.ts @@ -30,7 +30,6 @@ router.delete("/", route({ permission: "MANAGE_CHANNELS" }), async (req: Request } else if (channel.type === ChannelType.GROUP_DM) { await Channel.removeRecipientFromChannel(channel, req.user_id) } else { - //TODO messages in this channel should be deleted before deleting the channel await Promise.all([ Channel.delete({ id: channel_id }), emitEvent({ event: "CHANNEL_DELETE", data: channel, channel_id } as ChannelDeleteEvent) diff --git a/api/src/routes/users/@me/relationships.ts b/api/src/routes/users/@me/relationships.ts index 1d72f11a..6ad873a6 100644 --- a/api/src/routes/users/@me/relationships.ts +++ b/api/src/routes/users/@me/relationships.ts @@ -59,7 +59,7 @@ router.post("/", route({ body: "RelationshipPostSchema" }), async (req: Request, relations: ["relationships", "relationships.to"], select: userProjection, where: { - discriminator: String(req.body.discriminator,).padStart(4, '0'), //Discord send the discriminator as integer, we need to add leading zeroes + discriminator: String(req.body.discriminator).padStart(4, '0'), //Discord send the discriminator as integer, we need to add leading zeroes username: req.body.username } }), diff --git a/api/src/util/route.ts b/api/src/util/route.ts index 678ca64c..b7e6296b 100644 --- a/api/src/util/route.ts +++ b/api/src/util/route.ts @@ -14,6 +14,7 @@ export const ajv = new Ajv({ parseDate: true, allowDate: true, schemas, + coerceTypes: true, messages: true, strict: true, strictRequired: true |