mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
Fixed error when trying to save device back into group "None".
This commit is contained in:
parent
2c00af892e
commit
f82bf69cee
@ -221,29 +221,26 @@ namespace Remotely.Server.Components.Devices
|
||||
continue;
|
||||
}
|
||||
|
||||
if (_selectedGroupId == _deviceGroupNone &&
|
||||
!string.IsNullOrWhiteSpace(device.DeviceGroupID))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (_selectedGroupId != _deviceGroupAll &&
|
||||
_selectedGroupId != device.DeviceGroupID)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_filter) &&
|
||||
device.Alias?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true &&
|
||||
device.CurrentUser?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true &&
|
||||
device.DeviceName?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true &&
|
||||
device.Notes?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true &&
|
||||
device.Platform?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true &&
|
||||
device.Tags?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true)
|
||||
device.Alias?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true &&
|
||||
device.CurrentUser?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true &&
|
||||
device.DeviceName?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true &&
|
||||
device.Notes?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true &&
|
||||
device.Platform?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true &&
|
||||
device.Tags?.Contains(_filter, StringComparison.OrdinalIgnoreCase) != true)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
_filteredDevices.Add(device);
|
||||
if (_selectedGroupId == _deviceGroupAll ||
|
||||
_selectedGroupId == device.DeviceGroupID ||
|
||||
(
|
||||
_selectedGroupId == _deviceGroupNone &&
|
||||
string.IsNullOrWhiteSpace(device.DeviceGroupID
|
||||
)))
|
||||
{
|
||||
_filteredDevices.Add(device);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(_selectedSortProperty))
|
||||
|
||||
@ -1889,14 +1889,26 @@ namespace Remotely.Server.Services
|
||||
{
|
||||
using var dbContext = GetDbContext();
|
||||
|
||||
var device = dbContext.Devices.Find(deviceID);
|
||||
var device = dbContext.Devices
|
||||
.Include(x => x.DeviceGroup)
|
||||
.FirstOrDefault(x => x.ID == deviceID);
|
||||
if (device == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(deviceGroupID))
|
||||
{
|
||||
device.DeviceGroup?.Devices?.RemoveAll(x => x.ID == deviceID);
|
||||
device.DeviceGroup = null;
|
||||
device.DeviceGroupID = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
device.DeviceGroupID = deviceGroupID;
|
||||
}
|
||||
|
||||
device.Tags = tag;
|
||||
device.DeviceGroupID = deviceGroupID;
|
||||
device.Alias = alias;
|
||||
device.Notes = notes;
|
||||
device.WebRtcSetting = webRtcSetting;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user