Skip to content

Commit 726fa08

Browse files
feat: add capability support for multiple personal spaces (#11956)
1 parent 493080b commit 726fa08

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/libsync/capabilities.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ SpaceSupport::SpaceSupport(const QVariantMap &spaces_support)
304304
return;
305305
}
306306
enabled = spaces_support.value(QStringLiteral("enabled")).toBool();
307+
hasMultiplePersonalSpaces = spaces_support.value(QStringLiteral("has_multiple_personal_spaces")).toBool();
307308
version = QVersionNumber::fromString(spaces_support.value(QStringLiteral("version")).toString());
308309
}
309310

src/libsync/capabilities.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
#include "common/checksumalgorithms.h"
2222

23-
#include <QVariantMap>
2423
#include <QStringList>
24+
#include <QVariantMap>
2525
#include <QVersionNumber>
2626

2727
namespace OCC {
@@ -81,11 +81,13 @@ struct OWNCLOUDSYNC_EXPORT SpaceSupport
8181
/**
8282
"spaces": {
8383
"version": "0.0.1",
84-
"enabled": true
84+
"enabled": true,
85+
"has_multiple_personal_spaces": true
8586
}
8687
*/
8788
SpaceSupport(const QVariantMap &spaces_support);
8889
bool enabled = false;
90+
bool hasMultiplePersonalSpaces = false;
8991
QVersionNumber version;
9092

9193
bool isValid() const;
@@ -305,4 +307,4 @@ class OWNCLOUDSYNC_EXPORT Capabilities
305307
};
306308
}
307309

308-
#endif //CAPABILITIES_H
310+
#endif // CAPABILITIES_H

src/libsync/graphapi/space.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ void SpaceImage::update()
9797

9898
QString Space::displayName() const
9999
{
100+
auto hasManyPersonalSpaces = _spaceManager->account()->capabilities().spacesSupport().enabled;
101+
if (hasManyPersonalSpaces) {
102+
return _drive.getName();
103+
}
104+
100105
if (_drive.getDriveType() == personalC) {
101106
return tr("Personal");
102107
} else if (_drive.getId() == sharesIdC) {

0 commit comments

Comments
 (0)