Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work/document set virtual files enabled #11341

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/gui/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,16 @@ void Folder::setVirtualFilesEnabled(bool enabled)
}

if (newMode != _definition.virtualFilesMode) {
// This is tested in TestSyncVirtualFiles::testWipeVirtualSuffixFiles, so for changes here, have them reflected in that test.

// TODO: Must wait for current sync to finish!
OC_ENFORCE(!isSyncRunning());

// Wipe the dehydrated files from the DB, they will get downloaded on the next sync. We need to do this, otherwise the files
// are in the DB but not on disk, so the client assumes they are deleted, and removes them from the remote.
_vfs->wipeDehydratedVirtualFiles();

// Tear down the VFS
_vfs->stop();
_vfs->unregisterFolder();

Expand All @@ -782,6 +788,7 @@ void Folder::setVirtualFilesEnabled(bool enabled)
_vfsIsReady = false;
_vfs.reset(VfsPluginManager::instance().createVfsFromPlugin(newMode).release());

// Restart VFS.
_definition.virtualFilesMode = newMode;
startVfs();
saveToSettings();
Expand Down
2 changes: 2 additions & 0 deletions test/testsyncvirtualfiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,8 @@ private slots:

void testWipeVirtualSuffixFiles()
{
// This tests the procedure done in Folder::setVirtualFilesEnabled. For changes here, make sure they are reflected in that method.

FakeFolder fakeFolder{ FileInfo{} };
setupVfs(fakeFolder);

Expand Down
Loading