aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library/UserViewManager.cs
diff options
context:
space:
mode:
authorShadowghost <Shadowghost@users.noreply.github.com>2026-09-15 11:17:09 -0400
committerCody Robibero <cody@robibe.ro>2026-09-15 11:17:09 -0400
commit2151b992f96f6f0ba9d404977d536741a281584c (patch)
tree5d3f1d098e49dbac3b74246a4e5ed5462d230bbe /Emby.Server.Implementations/Library/UserViewManager.cs
parent8cd2293ff9bf4e0a797d1bcdc7d9addda53324b2 (diff)
Backport pull request #18039 from jellyfin/release-12.z
Stop resolving items with every field where only stored columns are read Original-merge: 408e5e01b1447e24689bd3653e2328bf173c8ce3 Merged-by: crobibero <cody@robibe.ro> Backported-by: Cody Robibero <cody@robibe.ro>
Diffstat (limited to 'Emby.Server.Implementations/Library/UserViewManager.cs')
-rw-r--r--Emby.Server.Implementations/Library/UserViewManager.cs48
1 files changed, 29 insertions, 19 deletions
diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.cs
index db911cd24a..cfb2dd53d3 100644
--- a/Emby.Server.Implementations/Library/UserViewManager.cs
+++ b/Emby.Server.Implementations/Library/UserViewManager.cs
@@ -60,26 +60,10 @@ namespace Emby.Server.Implementations.Library
var folderViewType = collectionFolder?.CollectionType;
// Playlist and BoxSet libraries require special handling because the folder only references linked items
- if (folderViewType == CollectionType.boxsets)
+ if ((folderViewType == CollectionType.playlists || folderViewType == CollectionType.boxsets)
+ && !HasVisibleChild(folder, user))
{
- // Only the existence of one visible box set matters here, so probe the children
- // lazily and stop at the first hit.
- if (!folder.Children.Any(item => item.IsVisible(user)))
- {
- continue;
- }
- }
- else if (folderViewType == CollectionType.playlists)
- {
- var items = folder.GetItemList(new InternalItemsQuery(user)
- {
- ParentId = folder.ParentId
- });
-
- if (!items.Any(item => item.IsVisible(user)))
- {
- continue;
- }
+ continue;
}
if (UserView.IsUserSpecific(folder))
@@ -168,6 +152,32 @@ namespace Emby.Server.Implementations.Library
.ToArray();
}
+ private bool HasVisibleChild(Folder folder, User user)
+ {
+ // Folder.Children answers this too, but a collection folder delegates it to its physical
+ // folders, which resolve and then hold on to every child with every field.
+ var parentIds = folder is CollectionFolder collectionFolder && collectionFolder.PhysicalFolderIds.Length > 0
+ ? collectionFolder.PhysicalFolderIds
+ : [folder.Id];
+
+ foreach (var parentId in parentIds)
+ {
+ var items = _libraryManager.GetItemList(new InternalItemsQuery(user)
+ {
+ ParentId = parentId,
+ GroupByPresentationUniqueKey = false,
+ DtoOptions = DtoOptions.StoredColumnsOnly
+ });
+
+ if (items.Any(item => item.IsVisible(user)))
+ {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
public UserView GetUserSubViewWithName(string name, Guid parentId, CollectionType? type, string sortName)
{
var uniqueId = parentId + "subview" + type;