summary refs log tree commit diff
path: root/src/api/routes
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2023-01-24 18:15:26 +1100
committerPuyodead1 <puyodead@proton.me>2023-03-18 19:33:32 -0400
commitc7277efbad5d3979222518ae543366ba8a08ca77 (patch)
tree89f9815b7c2a66908874eb0f2eb678aeb0211a96 /src/api/routes
parentCheck visibility for connected accounts in /users/:id/profile (diff)
downloadserver-c7277efbad5d3979222518ae543366ba8a08ca77.tar.xz
Move redirect uri generation to getRedirectUri function of Connection class.
Use api_endpointPublic instead of cdn_endpointPublic
Diffstat (limited to 'src/api/routes')
-rw-r--r--src/api/routes/users/@me/connections/#connection_name/#connection_id/index.ts12
1 files changed, 7 insertions, 5 deletions
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);