fix library changed
This commit is contained in:
parent
4f7e8fee24
commit
fbbab13b31
|
@ -104,7 +104,7 @@ namespace MediaBrowser.Controller.Channels
|
|||
|
||||
public override bool IsVisibleStandalone(User user)
|
||||
{
|
||||
return base.IsVisibleStandalone(user) && ChannelVideoItem.IsChannelVisible(this, user);
|
||||
return IsVisibleStandaloneInternal(user, false) && ChannelVideoItem.IsChannelVisible(this, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace MediaBrowser.Controller.Channels
|
|||
|
||||
public override bool IsVisibleStandalone(User user)
|
||||
{
|
||||
return base.IsVisibleStandalone(user) && ChannelVideoItem.IsChannelVisible(this, user);
|
||||
return IsVisibleStandaloneInternal(user, false) && ChannelVideoItem.IsChannelVisible(this, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace MediaBrowser.Controller.Channels
|
|||
|
||||
public override bool IsVisibleStandalone(User user)
|
||||
{
|
||||
return base.IsVisibleStandalone(user) && IsChannelVisible(this, user);
|
||||
return IsVisibleStandaloneInternal(user, false) && IsChannelVisible(this, user);
|
||||
}
|
||||
|
||||
internal static bool IsChannelVisible(IChannelItem item, User user)
|
||||
|
|
|
@ -1143,6 +1143,11 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
|
||||
public virtual bool IsVisibleStandalone(User user)
|
||||
{
|
||||
return IsVisibleStandaloneInternal(user, true);
|
||||
}
|
||||
|
||||
protected bool IsVisibleStandaloneInternal(User user, bool checkFolders)
|
||||
{
|
||||
if (!IsVisible(user))
|
||||
{
|
||||
|
@ -1154,6 +1159,8 @@ namespace MediaBrowser.Controller.Entities
|
|||
return false;
|
||||
}
|
||||
|
||||
if (checkFolders)
|
||||
{
|
||||
var topParent = Parents.LastOrDefault() ?? this;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(topParent.Path))
|
||||
|
@ -1161,10 +1168,16 @@ namespace MediaBrowser.Controller.Entities
|
|||
return true;
|
||||
}
|
||||
|
||||
var folders = user.RootFolder.GetChildren(user, true).Select(i => i.Id).ToList();
|
||||
var itemCollectionFolders = LibraryManager.GetCollectionFolders(this).Select(i => i.Id).ToList();
|
||||
var userCollectionFolders = user.RootFolder.GetChildren(user, true).Select(i => i.Id).ToList();
|
||||
var itemCollectionFolders = LibraryManager.GetCollectionFolders(this).Select(i => i.Id);
|
||||
|
||||
return itemCollectionFolders.Any(folders.Contains);
|
||||
if (!itemCollectionFolders.Any(userCollectionFolders.Contains))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1669,7 +1682,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
else
|
||||
{
|
||||
existing.DateModified = FileSystem.GetLastWriteTimeUtc(newImage);
|
||||
existing.Length = ((FileInfo) newImage).Length;
|
||||
existing.Length = ((FileInfo)newImage).Length;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -243,19 +243,17 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
{
|
||||
var user = _userManager.GetUserById(userId);
|
||||
|
||||
var collections = user.RootFolder.GetChildren(user, true).ToList();
|
||||
|
||||
return new LibraryUpdateInfo
|
||||
{
|
||||
ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
|
||||
ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
|
||||
ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, true)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
|
||||
FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
||||
|
||||
FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections)).Select(i => i.Id.ToString("N")).Distinct().ToList()
|
||||
FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList()
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -265,10 +263,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="user">The user.</param>
|
||||
/// <param name="collections">The collections.</param>
|
||||
/// <param name="includeIfNotFound">if set to <c>true</c> [include if not found].</param>
|
||||
/// <returns>IEnumerable{``0}.</returns>
|
||||
private IEnumerable<T> TranslatePhysicalItemToUserLibrary<T>(T item, User user, IEnumerable<BaseItem> collections, bool includeIfNotFound = false)
|
||||
private IEnumerable<T> TranslatePhysicalItemToUserLibrary<T>(T item, User user, bool includeIfNotFound = false)
|
||||
where T : BaseItem
|
||||
{
|
||||
// If the physical root changed, return the user root
|
||||
|
@ -277,15 +274,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|||
return new[] { user.RootFolder as T };
|
||||
}
|
||||
|
||||
// Need to find what user collection folder this belongs to
|
||||
if (item.Parent is AggregateFolder)
|
||||
{
|
||||
if (item.LocationType == LocationType.FileSystem)
|
||||
{
|
||||
return collections.Where(i => i.PhysicalLocations.Contains(item.Path)).Cast<T>();
|
||||
}
|
||||
}
|
||||
|
||||
// Return it only if it's in the user's library
|
||||
if (includeIfNotFound || item.IsVisibleStandalone(user))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user