From c7277efbad5d3979222518ae543366ba8a08ca77 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Tue, 24 Jan 2023 18:15:26 +1100 Subject: Move redirect uri generation to getRedirectUri function of Connection class. Use api_endpointPublic instead of cdn_endpointPublic --- .../@me/connections/#connection_name/#connection_id/index.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/api') diff --git a/src/api/routes/users/@me/connections/#connection_name/#connection_id/index.ts b/src/api/routes/users/@me/connections/#connection_name/#connection_id/index.ts index 07440eac..5b8936f0 100644 --- a/src/api/routes/users/@me/connections/#connection_name/#connection_id/index.ts +++ b/src/api/routes/users/@me/connections/#connection_name/#connection_id/index.ts @@ -3,7 +3,7 @@ import { ConnectedAccount, ConnectionUpdateSchema, DiscordApiErrors, - emitEvent + emitEvent, } from "@fosscord/util"; import { Request, Response, Router } from "express"; const router = Router(); @@ -38,10 +38,12 @@ router.patch( if (!connection) return DiscordApiErrors.UNKNOWN_CONNECTION; // TODO: do we need to do anything if the connection is revoked? - //@ts-ignore For some reason the client sends this as a boolean, even tho docs say its a number? - if (typeof body.visibility === "boolean") body.visibility = body.visibility ? 1 : 0; - //@ts-ignore For some reason the client sends this as a boolean, even tho docs say its a number? - if (typeof body.show_activity === "boolean") body.show_activity = body.show_activity ? 1 : 0; + if (typeof body.visibility === "boolean") + //@ts-expect-error For some reason the client sends this as a boolean, even tho docs say its a number? + body.visibility = body.visibility ? 1 : 0; + if (typeof body.show_activity === "boolean") + //@ts-expect-error For some reason the client sends this as a boolean, even tho docs say its a number? + body.show_activity = body.show_activity ? 1 : 0; connection.assign(req.body); -- cgit 1.5.1