aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Users/UserManager.cs
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2022-03-11 08:15:12 +0100
committerGitHub <noreply@github.com>2022-03-11 08:15:12 +0100
commit53209830e7b566949c16b43c864f6f85336cb92c (patch)
tree59a99d347cffe722da175269dfd99bac08fb7fb0 /Jellyfin.Server.Implementations/Users/UserManager.cs
parent21ef6661d6ef48fb18da10b8e0abf2c1d1345ed1 (diff)
parentf50a250cd9fac47bcbd9a05e99c8ffe4d294e320 (diff)
Merge pull request #7346 from Bond-009/guid
Optimize Guid comparisons
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/UserManager.cs')
-rw-r--r--Jellyfin.Server.Implementations/Users/UserManager.cs9
1 files changed, 4 insertions, 5 deletions
diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs
index c41b343c7..2100fa6d5 100644
--- a/Jellyfin.Server.Implementations/Users/UserManager.cs
+++ b/Jellyfin.Server.Implementations/Users/UserManager.cs
@@ -107,7 +107,7 @@ namespace Jellyfin.Server.Implementations.Users
/// <inheritdoc/>
public User? GetUserById(Guid id)
{
- if (id == Guid.Empty)
+ if (id.Equals(default))
{
throw new ArgumentException("Guid can't be empty", nameof(id));
}
@@ -146,8 +146,7 @@ namespace Jellyfin.Server.Implementations.Users
if (await dbContext.Users
.AsQueryable()
- .Where(u => u.Username == newName && u.Id != user.Id)
- .AnyAsync()
+ .AnyAsync(u => u.Username == newName && !u.Id.Equals(user.Id))
.ConfigureAwait(false))
{
throw new ArgumentException(string.Format(
@@ -597,7 +596,7 @@ namespace Jellyfin.Server.Implementations.Users
.Include(u => u.Preferences)
.Include(u => u.AccessSchedules)
.Include(u => u.ProfileImage)
- .FirstOrDefault(u => u.Id == userId)
+ .FirstOrDefault(u => u.Id.Equals(userId))
?? throw new ArgumentException("No user exists with given Id!");
user.SubtitleMode = config.SubtitleMode;
@@ -631,7 +630,7 @@ namespace Jellyfin.Server.Implementations.Users
.Include(u => u.Preferences)
.Include(u => u.AccessSchedules)
.Include(u => u.ProfileImage)
- .FirstOrDefault(u => u.Id == userId)
+ .FirstOrDefault(u => u.Id.Equals(userId))
?? throw new ArgumentException("No user exists with given Id!");
// The default number of login attempts is 3, but for some god forsaken reason it's sent to the server as "0"