mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
added full support for linked children
This commit is contained in:
parent
6aa3164092
commit
950cc50ae6
@ -16,6 +16,7 @@ using System.Linq;
|
|||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using MoreLinq;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
@ -981,6 +982,30 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var children = GetRecursiveChildrenInternal(user, includeLinkedChildren);
|
||||||
|
|
||||||
|
if (includeLinkedChildren)
|
||||||
|
{
|
||||||
|
children = children.DistinctBy(i => i.Id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets allowed recursive children of an item
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user">The user.</param>
|
||||||
|
/// <param name="includeLinkedChildren">if set to <c>true</c> [include linked children].</param>
|
||||||
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||||
|
/// <exception cref="System.ArgumentNullException"></exception>
|
||||||
|
private IEnumerable<BaseItem> GetRecursiveChildrenInternal(User user, bool includeLinkedChildren = true)
|
||||||
|
{
|
||||||
|
if (user == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException();
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var item in GetChildren(user, includeLinkedChildren))
|
foreach (var item in GetChildren(user, includeLinkedChildren))
|
||||||
{
|
{
|
||||||
yield return item;
|
yield return item;
|
||||||
@ -989,7 +1014,7 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
|
|
||||||
if (subFolder != null)
|
if (subFolder != null)
|
||||||
{
|
{
|
||||||
foreach (var subitem in subFolder.GetRecursiveChildren(user, includeLinkedChildren))
|
foreach (var subitem in subFolder.GetRecursiveChildrenInternal(user, includeLinkedChildren))
|
||||||
{
|
{
|
||||||
yield return subitem;
|
yield return subitem;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user