]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Move active folder size limit check to independent convenience method
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 27 Jun 2023 14:09:16 +0000 (22:09 +0800)
committerClaudio Cambra <claudio.cambra@nextcloud.com>
Fri, 4 Aug 2023 09:40:36 +0000 (17:40 +0800)
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/libsync/discoveryphase.cpp
src/libsync/discoveryphase.h

index 3fef366c5634791976382151a45d900a7f3cff4c..05ab702663ef70c2df051e3979020e561481320d 100644 (file)
@@ -82,11 +82,15 @@ bool DiscoveryPhase::isInSelectiveSyncBlackList(const QString &path) const
     return false;
 }
 
+bool DiscoveryPhase::activeFolderSizeLimit() const
+{
+    return _syncOptions._newBigFolderSizeLimit > 0 && _syncOptions._vfs->mode() == Vfs::Off;
+}
+
 void DiscoveryPhase::checkFolderSizeLimit(const QString &path,
                                           const std::function<void(bool)> callback)
 {
-    const auto limit = _syncOptions._newBigFolderSizeLimit;
-    if (limit < 0 || _syncOptions._vfs->mode() != Vfs::Off) {
+    if (activeFolderSizeLimit()) {
         // no limit, everything is allowed;
         return callback(false);
     }
@@ -98,8 +102,11 @@ void DiscoveryPhase::checkFolderSizeLimit(const QString &path,
 
     connect(propfindJob, &PropfindJob::finishedWithError, this, [=] { return callback(false); });
     connect(propfindJob, &PropfindJob::result, this, [=](const QVariantMap &values) {
-        auto result = values.value(QLatin1String("size")).toLongLong();
-        if (result >= limit) {
+
+        if (const auto result = values.value(QLatin1String("size")).toLongLong(),
+            limit = _syncOptions._newBigFolderSizeLimit;
+            result >= limit) {
+
             // we tell the UI there is a new folder
             emit newBigFolder(path, false);
             return callback(true);
index 948500371117e19abfc6ec12920a9b5f9a20e007..93f3989229acc7568a094a4a8c31b2b6220f2228 100644 (file)
@@ -255,6 +255,8 @@ class DiscoveryPhase : public QObject
 
     [[nodiscard]] bool isInSelectiveSyncBlackList(const QString &path) const;
 
+    [[nodiscard]] bool activeFolderSizeLimit() const;
+  
     void checkFolderSizeLimit(const QString &path,
                              const std::function<void(bool)> callback);