Do not notify if setting is not enabled for folders going over limit
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 4 Jul 2023 14:03:50 +0000 (22:03 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 4 Aug 2023 09:40:38 +0000 (17:40 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/libsync/discoveryphase.cpp
src/libsync/discoveryphase.h

index 8f2f1e7c88a8b027b0647f7e207b67f83d063203..14ff897947f8c65fe1ae72327ab5999fe56639ec 100644 (file)
@@ -13,6 +13,7 @@
  */
 
 #include "discoveryphase.h"
+#include "configfile.h"
 #include "discovery.h"
 #include "helpers.h"
 #include "progressdispatcher.h"
@@ -87,6 +88,11 @@ bool DiscoveryPhase::activeFolderSizeLimit() const
     return _syncOptions._newBigFolderSizeLimit > 0 && _syncOptions._vfs->mode() == Vfs::Off;
 }
 
+bool DiscoveryPhase::notifyExistingFolderOverLimit() const
+{
+    return activeFolderSizeLimit() && ConfigFile().notifyExistingFoldersOverLimit();
+}
+
 void DiscoveryPhase::checkFolderSizeLimit(const QString &path, const std::function<void(bool)> completionCallback)
 {
     if (!activeFolderSizeLimit()) {
@@ -152,9 +158,8 @@ void DiscoveryPhase::checkSelectiveSyncNewFolder(const QString &path,
 
 void DiscoveryPhase::checkSelectiveSyncExistingFolder(const QString &path)
 {
-    // TODO: Check for setting to obey big folder sync
     // If no size limit is enforced, or if is in whitelist (explicitly allowed) or in blacklist (explicitly disallowed), do nothing.
-    if (!activeFolderSizeLimit() || findPathInList(_selectiveSyncWhiteList, path) || findPathInList(_selectiveSyncBlackList, path)) {
+    if (!notifyExistingFolderOverLimit() || findPathInList(_selectiveSyncWhiteList, path) || findPathInList(_selectiveSyncBlackList, path)) {
         return;
     }
 
index dce4261e8202093be0ff9ee0599282ff589fafdf..900584066cd08869234f7aad3964cdabeae75629 100644 (file)
@@ -256,7 +256,8 @@ class DiscoveryPhase : public QObject
     [[nodiscard]] bool isInSelectiveSyncBlackList(const QString &path) const;
 
     [[nodiscard]] bool activeFolderSizeLimit() const;
-  
+    [[nodiscard]] bool notifyExistingFolderOverLimit() const;
+
     void checkFolderSizeLimit(const QString &path,
                              const std::function<void(bool)> callback);