No need to fetch encryption data separately before discovery
authorKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 8 Dec 2020 14:49:29 +0000 (15:49 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:59:23 +0000 (10:59 +0100)
This step isn't necessary anymore, no one looks at ClientSideEncryption
for that information anyway.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/libsync/syncengine.cpp
src/libsync/syncengine.h

index d314205b109a8aecbc36ff80e90c580b10e23188..9984ad7f73954f07fd0722ece169359391f157b5 100644 (file)
@@ -511,69 +511,6 @@ void SyncEngine::startSync()
         return;
     }
 
-    // If needed, make sure we have up to date E2E information before the
-    // discovery phase, otherwise we start right away
-    if (_account->capabilities().clientSideEncryptionAvailable()) {
-        connect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone,
-                this, &SyncEngine::onFolderEncryptedStatusFetchDone);
-        _account->e2e()->fetchFolderEncryptedStatus();
-    } else {
-        slotStartDiscovery();
-    }
-}
-
-void SyncEngine::onFolderEncryptedStatusFetchDone(const QHash<QString, bool> &values)
-{
-    disconnect(_account->e2e(), &ClientSideEncryption::folderEncryptedStatusFetchDone,
-               this, &SyncEngine::onFolderEncryptedStatusFetchDone);
-
-    Q_ASSERT(_remotePath.startsWith('/'));
-    const auto rootPath = [=]() {
-        const auto result = _remotePath;
-        if (result.startsWith('/')) {
-            return result.mid(1);
-        } else {
-            return result;
-        }
-    }();
-
-    std::for_each(values.constKeyValueBegin(), values.constKeyValueEnd(), [=](const std::pair<QString, bool> &pair) {
-        const auto key = pair.first;
-        const auto value = pair.second;
-
-        if (!key.startsWith(rootPath)) {
-            return;
-        }
-
-        Q_ASSERT(key.endsWith('/'));
-        const auto path = key.mid(rootPath.length()).chopped(1);
-
-        if (path.isEmpty()) {
-            // We don't store metadata about the root
-            return;
-        }
-
-        SyncJournalFileRecord rec;
-        _journal->getFileRecordByE2eMangledName(path, &rec);
-
-        if (!rec.isValid()) {
-            _journal->getFileRecord(path, &rec);
-        }
-
-        if (!rec.isValid()) {
-            // We don't know that folder yet anyway...
-            return;
-        }
-
-        rec._isE2eEncrypted = value;
-        _journal->setFileRecord(rec);
-    });
-
-    slotStartDiscovery();
-}
-
-void SyncEngine::slotStartDiscovery()
-{
     bool ok = false;
     auto selectiveSyncBlackList = _journal->getSelectiveSyncList(SyncJournalDb::SelectiveSyncBlackList, &ok);
     if (ok) {
index 9e23afe880feffe349fc9f7bd224673d478cdd81..57e40d49ac230ecbf6256f4f7680cb348ded59cb 100644 (file)
@@ -171,9 +171,6 @@ signals:
     void seenLockedFile(const QString &fileName);
 
 private slots:
-    void onFolderEncryptedStatusFetchDone(const QHash<QString, bool> &values);
-    void slotStartDiscovery();
-
     void slotFolderDiscovered(bool local, const QString &folder);
     void slotRootEtagReceived(const QString &);