diff --git "a/src/api/routes/guilds/\043guild_id/widget.json.ts" "b/src/api/routes/guilds/\043guild_id/widget.json.ts" index 362a4a1..12b31b8 100644 --- "a/src/api/routes/guilds/\043guild_id/widget.json.ts" +++ "b/src/api/routes/guilds/\043guild_id/widget.json.ts" @@ -51,7 +51,7 @@ where: { id: guild_id }, select: { channel_ordering: true, - } + }, }); if (!guild.widget_enabled) throw new HTTPError("Widget Disabled", 404); diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts index 9f19cb0..6538b52 100644 --- a/src/util/entities/Channel.ts +++ b/src/util/entities/Channel.ts @@ -459,8 +459,6 @@ } static async deleteChannel(channel: Channel) { - await Message.delete({ channel_id: channel.id }); //TODO we should also delete the attachments from the cdn but to do that we need to move cdn.ts in util - //TODO before deleting the channel we should check and delete other relations await Channel.delete({ id: channel.id }); const guild = await Guild.findOneOrFail({ @@ -471,7 +469,10 @@ const updatedOrdering = guild.channel_ordering.filter( (id) => id != channel.id, ); - await Guild.update({id: channel.guild_id}, { channel_ordering: updatedOrdering }); + await Guild.update( + { id: channel.guild_id }, + { channel_ordering: updatedOrdering }, + ); } static async calculatePosition( @@ -501,13 +502,15 @@ ), ); - return channels.filter(channel => channel !== null).reduce((r, v) => { - v = v as Channel; + return channels + .filter((channel) => channel !== null) + .reduce((r, v) => { + v = v as Channel; - v.position = (guild as Guild).channel_ordering.indexOf(v.id); - r[v.position] = v; - return r; - }, [] as Array); + v.position = (guild as Guild).channel_ordering.indexOf(v.id); + r[v.position] = v; + return r; + }, [] as Array); } isDm() {