diff options
| author | Patrick Barron <barronpm@gmail.com> | 2021-03-25 19:48:30 -0400 |
|---|---|---|
| committer | Patrick Barron <barronpm@gmail.com> | 2021-03-25 19:51:27 -0400 |
| commit | a7b29e2fe0bb08f4b8f37fa5aac7af66c7cb00e8 (patch) | |
| tree | e148c128629271ba30f88358475e3ee3b6147e72 | |
| parent | daa21c9e99a8b7b6e9a76c130f8e0943692bd1da (diff) | |
Clean up user renaming
| -rw-r--r-- | Jellyfin.Server.Implementations/Users/UserManager.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs index 50d7612f2..f9a1a8ee9 100644 --- a/Jellyfin.Server.Implementations/Users/UserManager.cs +++ b/Jellyfin.Server.Implementations/Users/UserManager.cs @@ -144,7 +144,13 @@ namespace Jellyfin.Server.Implementations.Users 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( CultureInfo.InvariantCulture, |
