fix(api): always add @everyone in user's roles
When you add or delete an user's role, you MUST always add "@everyone" role to the roles map
This commit is contained in:
		
							parent
							
								
									22467f2596
								
							
						
					
					
						commit
						4a617faf02
					
				| @ -28,6 +28,9 @@ router.patch("/", route({ body: "MemberChangeSchema" }), async (req: Request, re | ||||
| 
 | ||||
| 	if (body.roles) { | ||||
| 		permission.hasThrow("MANAGE_ROLES"); | ||||
| 
 | ||||
| 		const everyone = await Role.findOneOrFail({ guild_id: guild_id, name: "@everyone", position: 0 }); | ||||
| 		body.roles.push(everyone?.id); | ||||
| 		member.roles = body.roles.map((x) => new Role({ id: x })); // foreign key constraint will fail if role doesn't exist
 | ||||
| 	} | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Nobody
						Nobody