From 5b3ef06c6b0dd44fcf9f4ffd0a71accc17a68707 Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Wed, 10 May 2023 18:57:04 +0200 Subject: fix: don't create new vanity url when there's no ALIASABLE_NAMES flag --- src/api/routes/guilds/#guild_id/vanity-url.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/api/routes/guilds') diff --git a/src/api/routes/guilds/#guild_id/vanity-url.ts b/src/api/routes/guilds/#guild_id/vanity-url.ts index d271c976..941f463b 100644 --- a/src/api/routes/guilds/#guild_id/vanity-url.ts +++ b/src/api/routes/guilds/#guild_id/vanity-url.ts @@ -107,6 +107,12 @@ router.patch( where: { guild_id, type: ChannelType.GUILD_TEXT }, }); + if (!guild.features.includes("ALIASABLE_NAMES")) { + await Invite.update({ guild_id }, { + code: code + }); + } + await Invite.create({ vanity_url: true, code: code, -- cgit 1.4.1 From 6390786018f73703d2a73f0105dc29c2dfdde35b Mon Sep 17 00:00:00 2001 From: CyberL1 Date: Sat, 13 May 2023 11:09:52 +0200 Subject: fix: add return and run prettier --- src/api/routes/guilds/#guild_id/vanity-url.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/api/routes/guilds') diff --git a/src/api/routes/guilds/#guild_id/vanity-url.ts b/src/api/routes/guilds/#guild_id/vanity-url.ts index 941f463b..a64ae2c9 100644 --- a/src/api/routes/guilds/#guild_id/vanity-url.ts +++ b/src/api/routes/guilds/#guild_id/vanity-url.ts @@ -108,9 +108,14 @@ router.patch( }); if (!guild.features.includes("ALIASABLE_NAMES")) { - await Invite.update({ guild_id }, { - code: code - }); + await Invite.update( + { guild_id }, + { + code: code, + }, + ); + + return res.json({ code }); } await Invite.create({ -- cgit 1.4.1