GetDeviceOptions always returns an instance of DeviceOptions
This commit is contained in:
parent
d3e02e918d
commit
bbac9ff67e
|
@ -535,7 +535,7 @@ namespace Emby.Server.Implementations.Session
|
|||
}
|
||||
|
||||
var deviceOptions = await _deviceManager.GetDeviceOptions(deviceId).ConfigureAwait(false);
|
||||
if (string.IsNullOrEmpty(deviceOptions?.CustomName))
|
||||
if (string.IsNullOrEmpty(deviceOptions.CustomName))
|
||||
{
|
||||
sessionInfo.DeviceName = deviceName;
|
||||
}
|
||||
|
|
|
@ -107,12 +107,6 @@ namespace Jellyfin.Api.Controllers
|
|||
[FromQuery, Required] string id,
|
||||
[FromBody, Required] DeviceOptions deviceOptions)
|
||||
{
|
||||
var existingDeviceOptions = await _deviceManager.GetDeviceOptions(id).ConfigureAwait(false);
|
||||
if (existingDeviceOptions == null)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
await _deviceManager.UpdateDeviceOptions(id, deviceOptions).ConfigureAwait(false);
|
||||
return NoContent();
|
||||
}
|
||||
|
|
|
@ -74,13 +74,15 @@ namespace Jellyfin.Server.Implementations.Devices
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<DeviceOptions?> GetDeviceOptions(string deviceId)
|
||||
public async Task<DeviceOptions> GetDeviceOptions(string deviceId)
|
||||
{
|
||||
await using var dbContext = _dbProvider.CreateContext();
|
||||
return await dbContext.DeviceOptions
|
||||
var deviceOptions = await dbContext.DeviceOptions
|
||||
.AsQueryable()
|
||||
.FirstOrDefaultAsync(d => d.DeviceId == deviceId)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
return deviceOptions ?? new DeviceOptions(deviceId);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
Loading…
Reference in New Issue
Block a user