mirror of
				https://github.com/jellyfin/jellyfin.git
				synced 2025-11-04 03:27:21 -05:00 
			
		
		
		
	Clean up user renaming
This commit is contained in:
		
							parent
							
								
									daa21c9e99
								
							
						
					
					
						commit
						a7b29e2fe0
					
				@ -144,7 +144,13 @@ namespace Jellyfin.Server.Implementations.Users
 | 
				
			|||||||
                throw new ArgumentException("The new and old names must be different.");
 | 
					                throw new ArgumentException("The new and old names must be different.");
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (Users.Any(u => u.Id != user.Id && u.Username.Equals(newName, StringComparison.OrdinalIgnoreCase)))
 | 
					            await using var dbContext = _dbProvider.CreateContext();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (await dbContext.Users
 | 
				
			||||||
 | 
					                .AsQueryable()
 | 
				
			||||||
 | 
					                .Where(u => u.Username == newName && u.Id != user.Id)
 | 
				
			||||||
 | 
					                .AnyAsync()
 | 
				
			||||||
 | 
					                .ConfigureAwait(false))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                throw new ArgumentException(string.Format(
 | 
					                throw new ArgumentException(string.Format(
 | 
				
			||||||
                    CultureInfo.InvariantCulture,
 | 
					                    CultureInfo.InvariantCulture,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user