Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Müller <fmueller@owncloud.com>2022-11-07 17:51:34 +0300
committerHannah von Reth <vonreth@kde.org>2022-11-10 15:13:49 +0300
commitc81f0b29150877aa91d246420c80403a09122f51 (patch)
tree836ca8e0040612cdf6f9869d9c724ea5332b1249
parentd2dd8da6d75e3b9e0be6623b4a2d156bb5eab016 (diff)
Ignore disabled spaces during initial account setup
-rw-r--r--src/gui/owncloudgui.cpp6
-rw-r--r--src/libsync/graphapi/drives.cpp10
-rw-r--r--src/libsync/graphapi/drives.h5
3 files changed, 19 insertions, 2 deletions
diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp
index bafbdafb5..509ba0003 100644
--- a/src/gui/owncloudgui.cpp
+++ b/src/gui/owncloudgui.cpp
@@ -73,7 +73,11 @@ void setUpInitialSyncFolder(AccountStatePtr accountStatePtr, bool useVfs)
QObject::connect(drive, &GraphApi::Drives::finishedSignal, [accountStatePtr, drive, addFolder, finalize] {
if (drive->parseError().error == QJsonParseError::NoError) {
- const auto &drives = drive->drives();
+ auto drives = drive->drives();
+
+ // we do not want to set up folder sync connections for disabled spaces (#10173)
+ drives.erase(std::remove_if(drives.begin(), drives.end(), GraphApi::isDriveDisabled));
+
if (!drives.isEmpty()) {
const QDir localDir(accountStatePtr->account()->defaultSyncRoot());
FileSystem::setFolderMinimumPermissions(localDir.path());
diff --git a/src/libsync/graphapi/drives.cpp b/src/libsync/graphapi/drives.cpp
index e069cd85e..d18074654 100644
--- a/src/libsync/graphapi/drives.cpp
+++ b/src/libsync/graphapi/drives.cpp
@@ -76,4 +76,12 @@ uint32_t Drives::getDrivePriority(const OpenAPI::OAIDrive &drive)
return 50;
}
return 0;
-} \ No newline at end of file
+}
+
+namespace OCC::GraphApi {
+bool isDriveDisabled(const OpenAPI::OAIDrive &drive)
+{
+ // this is how disabled spaces are represented in the graph API
+ return drive.getRoot().getDeleted().getState() == QLatin1String("trashed");
+}
+}
diff --git a/src/libsync/graphapi/drives.h b/src/libsync/graphapi/drives.h
index 62b6dcc4f..6a371baf1 100644
--- a/src/libsync/graphapi/drives.h
+++ b/src/libsync/graphapi/drives.h
@@ -20,6 +20,11 @@
namespace OCC {
namespace GraphApi {
+ /**
+ * Check whether a drive object has been deleted.
+ */
+ bool OWNCLOUDSYNC_EXPORT isDriveDisabled(const OpenAPI::OAIDrive &drive);
+
class OWNCLOUDSYNC_EXPORT Drives : public JsonJob
{
Q_OBJECT