aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Devices/DeviceManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Server.Implementations/Devices/DeviceManager.cs')
-rw-r--r--Jellyfin.Server.Implementations/Devices/DeviceManager.cs28
1 files changed, 12 insertions, 16 deletions
diff --git a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs
index a55949df8..3203bed18 100644
--- a/Jellyfin.Server.Implementations/Devices/DeviceManager.cs
+++ b/Jellyfin.Server.Implementations/Devices/DeviceManager.cs
@@ -24,7 +24,7 @@ namespace Jellyfin.Server.Implementations.Devices
{
private readonly JellyfinDbProvider _dbProvider;
private readonly IUserManager _userManager;
- private readonly ConcurrentDictionary<string, ClientCapabilities> _capabilitiesMap = new ();
+ private readonly ConcurrentDictionary<string, ClientCapabilities> _capabilitiesMap = new();
/// <summary>
/// Initializes a new instance of the <see cref="DeviceManager"/> class.
@@ -120,7 +120,7 @@ namespace Jellyfin.Server.Implementations.Devices
if (query.UserId.HasValue)
{
- devices = devices.Where(device => device.UserId == query.UserId.Value);
+ devices = devices.Where(device => device.UserId.Equals(query.UserId.Value));
}
if (query.DeviceId != null)
@@ -145,12 +145,10 @@ namespace Jellyfin.Server.Implementations.Devices
devices = devices.Take(query.Limit.Value);
}
- return new QueryResult<Device>
- {
- Items = await devices.ToListAsync().ConfigureAwait(false),
- StartIndex = query.Skip ?? 0,
- TotalRecordCount = count
- };
+ return new QueryResult<Device>(
+ query.Skip,
+ count,
+ await devices.ToListAsync().ConfigureAwait(false));
}
/// <inheritdoc />
@@ -158,12 +156,10 @@ namespace Jellyfin.Server.Implementations.Devices
{
var devices = await GetDevices(query).ConfigureAwait(false);
- return new QueryResult<DeviceInfo>
- {
- Items = devices.Items.Select(device => ToDeviceInfo(device)).ToList(),
- StartIndex = devices.StartIndex,
- TotalRecordCount = devices.TotalRecordCount
- };
+ return new QueryResult<DeviceInfo>(
+ devices.StartIndex,
+ devices.TotalRecordCount,
+ devices.Items.Select(device => ToDeviceInfo(device)).ToList());
}
/// <inheritdoc />
@@ -173,8 +169,8 @@ namespace Jellyfin.Server.Implementations.Devices
var sessions = dbContext.Devices
.Include(d => d.User)
.AsQueryable()
- .OrderBy(d => d.DeviceId)
- .ThenByDescending(d => d.DateLastActivity)
+ .OrderByDescending(d => d.DateLastActivity)
+ .ThenBy(d => d.DeviceId)
.AsAsyncEnumerable();
if (supportsSync.HasValue)