Fix #4945
This commit is contained in:
		
							parent
							
								
									e103904a04
								
							
						
					
					
						commit
						01fab09683
					
				
					 1 changed files with 11 additions and 1 deletions
				
			
		|  | @ -42,7 +42,13 @@ export const meta = { | |||
| 			message: 'No such user.', | ||||
| 			code: 'NO_SUCH_USER', | ||||
| 			id: '0b5cc374-3681-41da-861e-8bc1146f7a55' | ||||
| 		} | ||||
| 		}, | ||||
| 
 | ||||
| 		isOwner: { | ||||
| 			message: 'The user is the owner.', | ||||
| 			code: 'IS_OWNER', | ||||
| 			id: '1546eed5-4414-4dea-81c1-b0aec4f6d2af' | ||||
| 		}, | ||||
| 	} | ||||
| }; | ||||
| 
 | ||||
|  | @ -63,6 +69,10 @@ export default define(meta, async (ps, me) => { | |||
| 		throw e; | ||||
| 	}); | ||||
| 
 | ||||
| 	if (user.id === userGroup.userId) { | ||||
| 		throw new ApiError(meta.errors.isOwner); | ||||
| 	} | ||||
| 
 | ||||
| 	// Pull the user
 | ||||
| 	await UserGroupJoinings.delete({ userId: user.id }); | ||||
| }); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue