aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Users
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2021-03-25 19:48:30 -0400
committerPatrick Barron <barronpm@gmail.com>2021-03-25 19:51:27 -0400
commita7b29e2fe0bb08f4b8f37fa5aac7af66c7cb00e8 (patch)
treee148c128629271ba30f88358475e3ee3b6147e72 /Jellyfin.Server.Implementations/Users
parentdaa21c9e99a8b7b6e9a76c130f8e0943692bd1da (diff)
Clean up user renaming
Diffstat (limited to 'Jellyfin.Server.Implementations/Users')
-rw-r--r--Jellyfin.Server.Implementations/Users/UserManager.cs8
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,