summary refs log tree commit diff
path: root/api
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-10 19:00:50 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-10-10 19:00:50 +0200
commitaa25dac99f9ab2c595d9deeb4067f753796438a1 (patch)
tree7ba66fb6cc5cb996a9c38d32457ec414719361a0 /api
parent:art: update migration script (diff)
downloadserver-aa25dac99f9ab2c595d9deeb4067f753796438a1.tar.xz
:bug: fix modify role.permissions
Diffstat (limited to 'api')
-rw-r--r--api/assets/schemas.json5
-rw-r--r--api/src/routes/guilds/#guild_id/roles.ts6
2 files changed, 7 insertions, 4 deletions
diff --git a/api/assets/schemas.json b/api/assets/schemas.json
index 4f1ab9a8..2ceaa923 100644
--- a/api/assets/schemas.json
+++ b/api/assets/schemas.json
@@ -2909,6 +2909,9 @@
                 }
             }
         },
+        "required": [
+            "image"
+        ],
         "definitions": {
             "ChannelPermissionOverwriteType": {
                 "enum": [
@@ -4744,7 +4747,7 @@
                 "type": "string"
             },
             "permissions": {
-                "type": "bigint"
+                "type": "string"
             },
             "color": {
                 "type": "integer"
diff --git a/api/src/routes/guilds/#guild_id/roles.ts b/api/src/routes/guilds/#guild_id/roles.ts
index 0a57c6a2..b1875598 100644
--- a/api/src/routes/guilds/#guild_id/roles.ts
+++ b/api/src/routes/guilds/#guild_id/roles.ts
@@ -17,7 +17,7 @@ const router: Router = Router();
 
 export interface RoleModifySchema {
 	name?: string;
-	permissions?: bigint;
+	permissions?: string;
 	color?: number;
 	hoist?: boolean; // whether the role should be displayed separately in the sidebar
 	mentionable?: boolean; // whether the role should be mentionable
@@ -57,7 +57,7 @@ router.post("/", route({ body: "RoleModifySchema", permission: "MANAGE_ROLES" })
 		...body,
 		guild_id: guild_id,
 		managed: false,
-		permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0"))),
+		permissions: String(req.permission!.bitfield & BigInt(body.permissions || "0")),
 		tags: undefined
 	});
 
@@ -109,7 +109,7 @@ router.patch("/:role_id", route({ body: "RoleModifySchema", permission: "MANAGE_
 		...body,
 		id: role_id,
 		guild_id,
-		permissions: String(req.permission!.bitfield & (body.permissions || BigInt("0")))
+		permissions: String(req.permission!.bitfield & BigInt(body.permissions || "0"))
 	});
 
 	await Promise.all([