]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Ensure newly whitelisted or blacklisted paths are removed from undecided list
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Wed, 5 Jul 2023 15:44:45 +0000 (23:44 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 4 Aug 2023 09:40:41 +0000 (17:40 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/folder.cpp
src/gui/folder.h

index 81c63dc561443cf6e4451b7f76b74e7161cd3e8f..dd246f109437e4ea624b1f4e6f079a72f312f95b 100644 (file)
@@ -856,14 +856,29 @@ void Folder::appendPathToSelectiveSyncList(const QString &path, const SyncJourna
     }
 }
 
+void Folder::removePathFromSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType listType)
+{
+    const auto folderPath = trailingSlashPath(path);
+    const auto journal = journalDb();
+    auto ok = false;
+    auto list = journal->getSelectiveSyncList(listType, &ok);
+
+    if (ok) {
+        list.removeAll(folderPath);
+        journal->setSelectiveSyncList(listType, list);
+    }
+}
+
 void Folder::whitelistPath(const QString &path)
 {
     appendPathToSelectiveSyncList(path, SyncJournalDb::SelectiveSyncWhiteList);
+    removePathFromSelectiveSyncList(path, SyncJournalDb::SelectiveSyncUndecidedList);
 }
 
 void Folder::blacklistPath(const QString &path)
 {
     appendPathToSelectiveSyncList(path, SyncJournalDb::SelectiveSyncBlackList);
+    removePathFromSelectiveSyncList(path, SyncJournalDb::SelectiveSyncUndecidedList);
 }
 
 bool Folder::isFileExcludedAbsolute(const QString &fullPath) const
index 5ffbde52d143a18a8255e225a770c00982f1b1d9..821f90716b8d6d48ca057efdc9c00ad048fb14d3 100644 (file)
@@ -472,6 +472,7 @@ private:
     void correctPlaceholderFiles();
 
     void appendPathToSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType listType);
+    void removePathFromSelectiveSyncList(const QString &path, const SyncJournalDb::SelectiveSyncListType listType);
 
     AccountStatePtr _accountState;
     FolderDefinition _definition;