Fixed a rare issue with move function fails to re-synchronize the item properly to target folder.

This commit is contained in:
Burak Kaan Köse
2024-06-21 23:44:59 +02:00
parent ad5c134887
commit 8c830761f3

View File

@@ -476,7 +476,11 @@ namespace Wino.Core.Services
.Where(a => a.MailAccountId == options.AccountId && a.IsSynchronizationEnabled && options.SynchronizationFolderIds.Contains(a.Id))
.ToListAsync();
folders.AddRange(synchronizationFolders);
// Order is important for moving.
// By implementation, removing mail folders must be synchronized first. Requests are made in that order for custom sync.
// eg. Moving item from Folder A to Folder B. If we start syncing Folder B first, we might miss adding assignment for Folder A.
folders.AddRange(synchronizationFolders.OrderBy(a => options.SynchronizationFolderIds.IndexOf(a.Id)));
}
return folders;