mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-16 22:13:06 +03:00
Optimize Guid comparisons
* Use Guid.Equals(Guid) instead of the == override * Ban the usage of Guid.Equals(Object) to prevent accidental boxing * Compare to default(Guid) instead of Guid.Empty
This commit is contained in:
@@ -74,7 +74,7 @@ namespace Jellyfin.Api.Controllers
|
||||
result = result.Where(i => string.Equals(i.DeviceId, deviceId, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
if (controllableByUserId.HasValue && !controllableByUserId.Equals(Guid.Empty))
|
||||
if (controllableByUserId.HasValue && !controllableByUserId.Equals(default))
|
||||
{
|
||||
result = result.Where(i => i.SupportsRemoteControl);
|
||||
|
||||
@@ -82,12 +82,12 @@ namespace Jellyfin.Api.Controllers
|
||||
|
||||
if (!user.HasPermission(PermissionKind.EnableRemoteControlOfOtherUsers))
|
||||
{
|
||||
result = result.Where(i => i.UserId.Equals(Guid.Empty) || i.ContainsUser(controllableByUserId.Value));
|
||||
result = result.Where(i => i.UserId.Equals(default) || i.ContainsUser(controllableByUserId.Value));
|
||||
}
|
||||
|
||||
if (!user.HasPermission(PermissionKind.EnableSharedDeviceControl))
|
||||
{
|
||||
result = result.Where(i => !i.UserId.Equals(Guid.Empty));
|
||||
result = result.Where(i => !i.UserId.Equals(default));
|
||||
}
|
||||
|
||||
if (activeWithinSeconds.HasValue && activeWithinSeconds.Value > 0)
|
||||
|
||||
Reference in New Issue
Block a user