|  |  |  | @ -7,6 +7,7 @@ package admin | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import ( | 
			
		
	
		
			
				
					|  |  |  |  | 	"errors" | 
			
		
	
		
			
				
					|  |  |  |  | 	"fmt" | 
			
		
	
		
			
				
					|  |  |  |  | 	"net/http" | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	"code.gitea.io/gitea/models" | 
			
		
	
	
		
			
				
					|  |  |  | @ -227,6 +228,11 @@ func DeleteUser(ctx *context.APIContext) { | 
			
		
	
		
			
				
					|  |  |  |  | 		return | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	if u.IsOrganization() { | 
			
		
	
		
			
				
					|  |  |  |  | 		ctx.Error(http.StatusUnprocessableEntity, "", fmt.Errorf("%s is an organization not a user", u.Name)) | 
			
		
	
		
			
				
					|  |  |  |  | 		return | 
			
		
	
		
			
				
					|  |  |  |  | 	} | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 	if err := models.DeleteUser(u); err != nil { | 
			
		
	
		
			
				
					|  |  |  |  | 		if models.IsErrUserOwnRepos(err) || | 
			
		
	
		
			
				
					|  |  |  |  | 			models.IsErrUserHasOrgs(err) { | 
			
		
	
	
		
			
				
					|  |  |  | 
 |