Fixing single threads for API threading strategy.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Wino.Core.Domain.Entities;
|
||||
using Wino.Core.Domain.Models.Folders;
|
||||
using Wino.Core.Domain.Models.MailItem;
|
||||
|
||||
namespace Wino.Core.Domain.Interfaces
|
||||
@@ -12,7 +13,7 @@ namespace Wino.Core.Domain.Interfaces
|
||||
/// </summary>
|
||||
/// <param name="items">Original mails.</param>
|
||||
/// <returns>Original mails with thread mails.</returns>
|
||||
Task<List<IMailItem>> ThreadItemsAsync(List<MailCopy> items);
|
||||
Task<List<IMailItem>> ThreadItemsAsync(List<MailCopy> items, IMailItemFolder threadingForFolder);
|
||||
bool ShouldThreadWithItem(IMailItem originalItem, IMailItem targetItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,19 +14,19 @@ namespace Wino.Core.Domain.Models.MailItem
|
||||
public IMailItem LatestMailItem => ThreadItems.LastOrDefault();
|
||||
public IMailItem FirstMailItem => ThreadItems.FirstOrDefault();
|
||||
|
||||
public void AddThreadItem(IMailItem item)
|
||||
public bool AddThreadItem(IMailItem item)
|
||||
{
|
||||
if (item == null) return;
|
||||
if (item == null) return false;
|
||||
|
||||
if (ThreadItems.Any(a => a.Id == item.Id))
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item != null && item.IsDraft)
|
||||
{
|
||||
ThreadItems.Insert(0, item);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
var insertItem = ThreadItems.FirstOrDefault(a => !a.IsDraft && a.CreationDate < item.CreationDate);
|
||||
@@ -39,6 +39,8 @@ namespace Wino.Core.Domain.Models.MailItem
|
||||
|
||||
ThreadItems.Insert(index, item);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<Guid> GetContainingIds() => ThreadItems?.Select(a => a.UniqueId) ?? default;
|
||||
|
||||
Reference in New Issue
Block a user