mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 05:02:37 +01:00
Merge pull request #386 from ChrisChrome/master
Delete messages before deleting channel
This commit is contained in:
commit
e463a7cc4f
@ -30,7 +30,6 @@ router.delete("/", route({ permission: "MANAGE_CHANNELS" }), async (req: Request
|
|||||||
} else if (channel.type === ChannelType.GROUP_DM) {
|
} else if (channel.type === ChannelType.GROUP_DM) {
|
||||||
await Channel.removeRecipientFromChannel(channel, req.user_id)
|
await Channel.removeRecipientFromChannel(channel, req.user_id)
|
||||||
} else {
|
} else {
|
||||||
//TODO messages in this channel should be deleted before deleting the channel
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
Channel.delete({ id: channel_id }),
|
Channel.delete({ id: channel_id }),
|
||||||
emitEvent({ event: "CHANNEL_DELETE", data: channel, channel_id } as ChannelDeleteEvent)
|
emitEvent({ event: "CHANNEL_DELETE", data: channel, channel_id } as ChannelDeleteEvent)
|
||||||
|
@ -59,7 +59,7 @@ router.post("/", route({ body: "RelationshipPostSchema" }), async (req: Request,
|
|||||||
relations: ["relationships", "relationships.to"],
|
relations: ["relationships", "relationships.to"],
|
||||||
select: userProjection,
|
select: userProjection,
|
||||||
where: {
|
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
|
username: req.body.username
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
@ -14,6 +14,7 @@ export const ajv = new Ajv({
|
|||||||
parseDate: true,
|
parseDate: true,
|
||||||
allowDate: true,
|
allowDate: true,
|
||||||
schemas,
|
schemas,
|
||||||
|
coerceTypes: true,
|
||||||
messages: true,
|
messages: true,
|
||||||
strict: true,
|
strict: true,
|
||||||
strictRequired: true
|
strictRequired: true
|
||||||
|
Loading…
Reference in New Issue
Block a user