update notifications

pull/702/head
Luke Pulverenti 8 years ago
parent 845c4a0d62
commit db9c02fffd

@ -149,6 +149,24 @@ namespace MediaBrowser.Api.UserLibrary
item = user == null ? _libraryManager.RootFolder : user.RootFolder;
}
if (!string.IsNullOrEmpty(request.Ids))
{
var query = GetItemsQuery(request, user);
var specificItems = _libraryManager.GetItemList(query).ToArray();
if (query.SortBy.Length == 0)
{
var ids = query.ItemIds.ToList();
// Try to preserve order
specificItems = specificItems.OrderBy(i => ids.IndexOf(i.Id.ToString("N"))).ToArray();
}
return new QueryResult<BaseItem>
{
Items = specificItems.ToArray(),
TotalRecordCount = specificItems.Length
};
}
// Default list type = children
var folder = item as Folder;
@ -157,16 +175,11 @@ namespace MediaBrowser.Api.UserLibrary
folder = user == null ? _libraryManager.RootFolder : _libraryManager.GetUserRootFolder();
}
if (request.Recursive || !string.IsNullOrEmpty(request.Ids))
if (request.Recursive || !string.IsNullOrEmpty(request.Ids) || user == null)
{
return await folder.GetItems(GetItemsQuery(request, user)).ConfigureAwait(false);
}
if (user == null)
{
return await folder.GetItems(GetItemsQuery(request, null)).ConfigureAwait(false);
}
var userRoot = item as UserRootFolder;
if (userRoot == null)

@ -1465,7 +1465,12 @@ namespace MediaBrowser.Server.Implementations.Library
private void AddUserToQuery(InternalItemsQuery query, User user)
{
if (query.AncestorIds.Length == 0 && !query.ParentId.HasValue && query.ChannelIds.Length == 0 && query.TopParentIds.Length == 0 && string.IsNullOrWhiteSpace(query.AncestorWithPresentationUniqueKey))
if (query.AncestorIds.Length == 0 &&
!query.ParentId.HasValue &&
query.ChannelIds.Length == 0 &&
query.TopParentIds.Length == 0 &&
string.IsNullOrWhiteSpace(query.AncestorWithPresentationUniqueKey)
&& query.ItemIds.Length == 0)
{
var userViews = _userviewManager().GetUserViews(new UserViewQuery
{

@ -3152,17 +3152,17 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
if (query.ItemIds.Length > 0)
{
var excludeIds = new List<string>();
var includeIds = new List<string>();
var index = 0;
foreach (var id in query.ItemIds)
{
excludeIds.Add("Guid = @IncludeId" + index);
includeIds.Add("Guid = @IncludeId" + index);
cmd.Parameters.Add(cmd, "@IncludeId" + index, DbType.Guid).Value = new Guid(id);
index++;
}
whereClauses.Add(string.Join(" OR ", excludeIds.ToArray()));
whereClauses.Add(string.Join(" OR ", includeIds.ToArray()));
}
if (query.ExcludeItemIds.Length > 0)
{

Loading…
Cancel
Save