From 8b692fa5e218d5bb7fb2a67e70d7aceb63326870 Mon Sep 17 00:00:00 2001 From: Isaac Date: Fri, 17 Mar 2023 21:42:47 +0000 Subject: [PATCH] fix: update categories cache when guild settings are changed --- src/routes/api/admin/guilds/[guild]/settings.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/routes/api/admin/guilds/[guild]/settings.js b/src/routes/api/admin/guilds/[guild]/settings.js index 09350f5..2c14ad9 100644 --- a/src/routes/api/admin/guilds/[guild]/settings.js +++ b/src/routes/api/admin/guilds/[guild]/settings.js @@ -54,9 +54,16 @@ module.exports.patch = fastify => ({ const original = await client.prisma.guild.findUnique({ where: { id } }); const settings = await client.prisma.guild.update({ data: data, + include: { categories: { select: { id: true } } }, where: { id }, }); + // Update cached categories, which include guild settings + for (const { id } of settings.categories) await client.tickets.getCategory(id, true); + + // don't log the categories + delete settings.categories; + logAdminEvent(client, { action: 'update', diff: {