Vfs: Make dehydration a SYNC and not a NEW action
authorChristian Kamm <mail@ckamm.de>
Fri, 8 Feb 2019 11:18:22 +0000 (12:18 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:40 +0000 (10:58 +0100)
That change will be useful for the notifications. Previously the
dehydrated files were reported as "newly downloaded", now they're
reported as "updated".

src/libsync/discovery.cpp
test/testsyncvirtualfiles.cpp

index 51dc164ddbfb330a921abf4fd107fa880ac8fdb5..c2c1db09986216ca8bd3eadd12688e7d35b3d56f 100644 (file)
@@ -642,7 +642,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
             } else if (dbEntry._type == ItemTypeVirtualFileDehydration) {
                 // dehydration requested
                 item->_direction = SyncFileItem::Down;
-                item->_instruction = CSYNC_INSTRUCTION_NEW;
+                item->_instruction = CSYNC_INSTRUCTION_SYNC;
                 item->_type = ItemTypeVirtualFileDehydration;
             }
         } else if (noServerEntry) {
@@ -707,7 +707,7 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo(
                 item->_direction = SyncFileItem::Down;
             } else if (dbEntry._type == ItemTypeVirtualFileDehydration || localEntry.type == ItemTypeVirtualFileDehydration) {
                 item->_direction = SyncFileItem::Down;
-                item->_instruction = CSYNC_INSTRUCTION_NEW;
+                item->_instruction = CSYNC_INSTRUCTION_SYNC;
                 item->_type = ItemTypeVirtualFileDehydration;
             } else if (!serverModified && dbEntry._inode != localEntry.inode) {
                 item->_instruction = CSYNC_INSTRUCTION_UPDATE_METADATA;
@@ -970,7 +970,7 @@ void ProcessDirectoryJob::processFileFinalize(
                 addVirtualFileSuffix(item->_file);
         }
         if (item->_type == ItemTypeVirtualFileDehydration
-            && item->_instruction == CSYNC_INSTRUCTION_NEW) {
+            && item->_instruction == CSYNC_INSTRUCTION_SYNC) {
             item->_renameTarget = item->_file;
             addVirtualFileSuffix(item->_renameTarget);
         }
index b2b3ef239f4db7e7e3a726d3a498270154478955..3c461cad011c2adb7627623811e6536acc8ad2c4 100644 (file)
@@ -677,8 +677,10 @@ private slots:
 
         QVERIFY(isDehydrated("A/a1"));
         QVERIFY(hasDehydratedDbEntries("A/a1"));
+        QVERIFY(itemInstruction(completeSpy, "A/a1.nextcloud", CSYNC_INSTRUCTION_SYNC));
         QVERIFY(isDehydrated("A/a2"));
         QVERIFY(hasDehydratedDbEntries("A/a2"));
+        QVERIFY(itemInstruction(completeSpy, "A/a2.nextcloud", CSYNC_INSTRUCTION_SYNC));
 
         QVERIFY(!fakeFolder.currentLocalState().find("B/b1"));
         QVERIFY(!fakeFolder.currentRemoteState().find("B/b1"));