summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2024-08-24 07:49:43 +1000
committerGitHub <noreply@github.com>2024-08-24 07:49:43 +1000
commit60f22c227c3f5e990480735be1af7cab65efaa09 (patch)
treeb899acc47903a96aedae17a54dd17310bef5a075 /src
parentMerge pull request #1180 from DEVTomatoCake/fix/guild-create-response-schema (diff)
parentFix updating vanity URL & retrieving widget.json (diff)
downloadserver-ts-60f22c227c3f5e990480735be1af7cab65efaa09.tar.xz
Merge pull request #1194 from DEVTomatoCake/fix/update-vanity-url-widget-invite
Fix updating vanity URL & widget.json
Diffstat (limited to 'src')
-rw-r--r--src/api/routes/guilds/#guild_id/vanity-url.ts21
-rw-r--r--src/api/routes/guilds/#guild_id/widget.json.ts5
2 files changed, 12 insertions, 14 deletions
diff --git a/src/api/routes/guilds/#guild_id/vanity-url.ts b/src/api/routes/guilds/#guild_id/vanity-url.ts

index a64ae2c9..34595ca6 100644 --- a/src/api/routes/guilds/#guild_id/vanity-url.ts +++ b/src/api/routes/guilds/#guild_id/vanity-url.ts
@@ -1,17 +1,17 @@ /* Spacebar: A FOSS re-implementation and extension of the Discord.com backend. Copyright (C) 2023 Spacebar and Spacebar Contributors - + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. */ @@ -108,30 +108,23 @@ router.patch( }); if (!guild.features.includes("ALIASABLE_NAMES")) { - await Invite.update( - { guild_id }, - { - code: code, - }, - ); - - return res.json({ code }); + await Invite.delete({ guild_id, vanity_url: true }); } await Invite.create({ vanity_url: true, - code: code, + code, temporary: false, uses: 0, max_uses: 0, max_age: 0, created_at: new Date(), - expires_at: new Date(), guild_id: guild_id, channel_id: id, + flags: 0, }).save(); - return res.json({ code: code }); + return res.json({ code }); }, ); diff --git a/src/api/routes/guilds/#guild_id/widget.json.ts b/src/api/routes/guilds/#guild_id/widget.json.ts
index 6c272e81..5d9f28c2 100644 --- a/src/api/routes/guilds/#guild_id/widget.json.ts +++ b/src/api/routes/guilds/#guild_id/widget.json.ts
@@ -57,6 +57,10 @@ router.get( where: { id: guild_id }, select: { channel_ordering: true, + widget_channel_id: true, + widget_enabled: true, + presence_count: true, + name: true, }, }); if (!guild.widget_enabled) throw DiscordApiErrors.EMBED_DISABLED; @@ -82,6 +86,7 @@ router.get( created_at: new Date(), guild_id, channel_id: guild.widget_channel_id, + flags: 0, }).save(); }