diff options
| author | dkanada <dkanada@users.noreply.github.com> | 2020-02-23 10:48:47 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-23 10:48:47 +0900 |
| commit | 6715450598e175efb3dc42d9448d2e421d854bdb (patch) | |
| tree | fa0195e56ab13507776ff18e6e56a54ef81cb2d3 /Emby.Server.Implementations/Devices/DeviceManager.cs | |
| parent | 804ca0543b1c746a751142edc6525d157da472c9 (diff) | |
| parent | adc9fc282cf94adbfb48b3680246105b55d24ff5 (diff) | |
Merge pull request #2427 from Bond-009/minor
Minor improvements
Diffstat (limited to 'Emby.Server.Implementations/Devices/DeviceManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Devices/DeviceManager.cs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/Emby.Server.Implementations/Devices/DeviceManager.cs b/Emby.Server.Implementations/Devices/DeviceManager.cs index 2bd0b840a..4f8f9f23b 100644 --- a/Emby.Server.Implementations/Devices/DeviceManager.cs +++ b/Emby.Server.Implementations/Devices/DeviceManager.cs @@ -142,11 +142,10 @@ namespace Emby.Server.Implementations.Devices public QueryResult<DeviceInfo> GetDevices(DeviceQuery query) { - var sessions = _authRepo.Get(new AuthenticationInfoQuery + IEnumerable<AuthenticationInfo> sessions = _authRepo.Get(new AuthenticationInfoQuery { //UserId = query.UserId HasUser = true - }).Items; // TODO: DeviceQuery doesn't seem to be used from client. Not even Swagger. @@ -154,23 +153,19 @@ namespace Emby.Server.Implementations.Devices { var val = query.SupportsSync.Value; - sessions = sessions.Where(i => GetCapabilities(i.DeviceId).SupportsSync == val).ToArray(); + sessions = sessions.Where(i => GetCapabilities(i.DeviceId).SupportsSync == val); } if (!query.UserId.Equals(Guid.Empty)) { var user = _userManager.GetUserById(query.UserId); - sessions = sessions.Where(i => CanAccessDevice(user, i.DeviceId)).ToArray(); + sessions = sessions.Where(i => CanAccessDevice(user, i.DeviceId)); } var array = sessions.Select(ToDeviceInfo).ToArray(); - return new QueryResult<DeviceInfo> - { - Items = array, - TotalRecordCount = array.Length - }; + return new QueryResult<DeviceInfo>(array); } private DeviceInfo ToDeviceInfo(AuthenticationInfo authInfo) @@ -186,7 +181,7 @@ namespace Emby.Server.Implementations.Devices LastUserName = authInfo.UserName, Name = authInfo.DeviceName, DateLastActivity = authInfo.DateLastActivity, - IconUrl = caps == null ? null : caps.IconUrl + IconUrl = caps?.IconUrl }; } |
