From 8c830761f37c91c3a0241e8675cce4c6e7d7c9d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Kaan=20K=C3=B6se?= Date: Fri, 21 Jun 2024 23:44:59 +0200 Subject: [PATCH] Fixed a rare issue with move function fails to re-synchronize the item properly to target folder. --- Wino.Core/Services/FolderService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Wino.Core/Services/FolderService.cs b/Wino.Core/Services/FolderService.cs index dd4ad445..65808d32 100644 --- a/Wino.Core/Services/FolderService.cs +++ b/Wino.Core/Services/FolderService.cs @@ -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;