mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 01:54:42 +01:00
Use DistinctBy introduced in .NET 6
This commit is contained in:
@@ -574,8 +574,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
.Where(i => user is null ?
|
||||
true :
|
||||
i.IsVisible(user))
|
||||
.GroupBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
|
||||
.Select(x => x.First())
|
||||
.DistinctBy(x => x.Name, StringComparer.OrdinalIgnoreCase)
|
||||
.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
for (var i = 0; i < people.Count; i++)
|
||||
|
||||
@@ -282,19 +282,16 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
{
|
||||
// Remove dupes in case some were saved multiple times
|
||||
var foldersAddedTo = _foldersAddedTo
|
||||
.GroupBy(x => x.Id)
|
||||
.Select(x => x.First())
|
||||
.DistinctBy(x => x.Id)
|
||||
.ToList();
|
||||
|
||||
var foldersRemovedFrom = _foldersRemovedFrom
|
||||
.GroupBy(x => x.Id)
|
||||
.Select(x => x.First())
|
||||
.DistinctBy(x => x.Id)
|
||||
.ToList();
|
||||
|
||||
var itemsUpdated = _itemsUpdated
|
||||
.Where(i => !_itemsAdded.Contains(i))
|
||||
.GroupBy(x => x.Id)
|
||||
.Select(x => x.First())
|
||||
.DistinctBy(x => x.Id)
|
||||
.ToList();
|
||||
|
||||
SendChangeNotifications(_itemsAdded.ToList(), itemsUpdated, _itemsRemoved.ToList(), foldersAddedTo, foldersRemovedFrom, CancellationToken.None).GetAwaiter().GetResult();
|
||||
|
||||
@@ -123,8 +123,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
var dtoList = changedItems
|
||||
.GroupBy(x => x.Id)
|
||||
.Select(x => x.First())
|
||||
.DistinctBy(x => x.Id)
|
||||
.Select(i =>
|
||||
{
|
||||
var dto = _userDataManager.GetUserDataDto(i, user);
|
||||
|
||||
@@ -133,8 +133,7 @@ namespace Emby.Server.Implementations.IO
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.Select(GetAffectedBaseItem)
|
||||
.Where(item => item is not null)
|
||||
.GroupBy(x => x!.Id) // Removed null values in the previous .Where()
|
||||
.Select(x => x.First())!;
|
||||
.DistinctBy(x => x!.Id)!; // Removed null values in the previous .Where()
|
||||
|
||||
foreach (var item in itemsToRefresh)
|
||||
{
|
||||
|
||||
@@ -81,8 +81,7 @@ namespace Emby.Server.Implementations.Images
|
||||
}
|
||||
|
||||
return i;
|
||||
}).GroupBy(x => x.Id)
|
||||
.Select(x => x.First());
|
||||
}).DistinctBy(x => x.Id);
|
||||
|
||||
List<BaseItem> returnItems;
|
||||
if (isUsingCollectionStrip)
|
||||
|
||||
@@ -58,8 +58,7 @@ namespace Emby.Server.Implementations.Images
|
||||
return null;
|
||||
})
|
||||
.Where(i => i is not null)
|
||||
.GroupBy(x => x.Id)
|
||||
.Select(x => x.First())
|
||||
.DistinctBy(x => x.Id)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2392,8 +2392,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||
.Select(i => _libraryManager.FindByPath(i, true))
|
||||
.Where(i => i is not null && i.IsVisibleStandalone(user))
|
||||
.SelectMany(i => _libraryManager.GetCollectionFolders(i))
|
||||
.GroupBy(x => x.Id)
|
||||
.Select(x => x.First())
|
||||
.DistinctBy(x => x.Id)
|
||||
.OrderBy(i => i.SortName)
|
||||
.ToList();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user