Skip to content

Commit e09ca2e

Browse files
authored
Merge pull request #9609 from nextcloud/backport/9605/stable-33.0
[stable-33.0] Bugfix/use display name for e2ee shares
2 parents 02b490c + e02177c commit e09ca2e

File tree

4 files changed

+31
-18
lines changed

4 files changed

+31
-18
lines changed

src/gui/sharemanager.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ void ShareManager::createE2EeShareJob(const QString &fullRemotePath,
521521
UpdateE2eeFolderUsersMetadataJob::Add,
522522
fullRemotePath,
523523
sharee->shareWith(),
524+
sharee->displayName(),
524525
QSslCertificate{},
525526
this);
526527

src/libsync/updatee2eefolderusersmetadatajob.cpp

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,23 @@ namespace OCC
1616
Q_LOGGING_CATEGORY(lcUpdateE2eeFolderUsersMetadataJob, "nextcloud.gui.updatee2eefolderusersmetadatajob", QtInfoMsg)
1717

1818
UpdateE2eeFolderUsersMetadataJob::UpdateE2eeFolderUsersMetadataJob(const AccountPtr &account,
19-
SyncJournalDb *journalDb,
20-
const QString &syncFolderRemotePath,
21-
const Operation operation,
22-
const QString &fullRemotePath,
23-
const QString &folderUserId,
24-
const QSslCertificate &certificate,
25-
QObject *parent)
26-
: QObject(parent)
27-
, _account(account)
28-
, _journalDb(journalDb)
29-
, _syncFolderRemotePath(Utility::noLeadingSlashPath(Utility::noTrailingSlashPath(syncFolderRemotePath)))
30-
, _operation(operation)
31-
, _fullRemotePath(Utility::noLeadingSlashPath(fullRemotePath))
32-
, _folderUserId(folderUserId)
33-
, _folderUserCertificate(certificate)
19+
SyncJournalDb *journalDb,
20+
const QString &syncFolderRemotePath,
21+
const Operation operation,
22+
const QString &fullRemotePath,
23+
const QString &folderUserId,
24+
const QString &folderUserDisplayName,
25+
const QSslCertificate &certificate,
26+
QObject *parent)
27+
: QObject{parent}
28+
, _account{account}
29+
, _journalDb{journalDb}
30+
, _syncFolderRemotePath{Utility::noLeadingSlashPath(Utility::noTrailingSlashPath(syncFolderRemotePath))}
31+
, _operation{operation}
32+
, _fullRemotePath{Utility::noLeadingSlashPath(fullRemotePath)}
33+
, _folderUserId{folderUserId}
34+
, _folderUserDisplayName{folderUserDisplayName}
35+
, _folderUserCertificate{certificate}
3436
{
3537
Q_ASSERT(_syncFolderRemotePath == QStringLiteral("/") || _fullRemotePath.startsWith(_syncFolderRemotePath));
3638
SyncJournalFileRecord rec;
@@ -78,7 +80,7 @@ void UpdateE2eeFolderUsersMetadataJob::start(const bool keepLock)
7880
void UpdateE2eeFolderUsersMetadataJob::slotStartE2eeMetadataJobs()
7981
{
8082
if (_operation == Operation::Add && _folderUserCertificate.isNull()) {
81-
emit finished(404, tr("Could not fetch public key for user %1").arg(_folderUserId));
83+
emit finished(404, tr("Could not fetch public key for user %1").arg(_folderUserDisplayName));
8284
return;
8385
}
8486

@@ -106,7 +108,7 @@ void UpdateE2eeFolderUsersMetadataJob::slotFetchMetadataJobFinished(int statusCo
106108
}
107109

108110
if (!_encryptedFolderMetadataHandler->folderMetadata() || !_encryptedFolderMetadataHandler->folderMetadata()->isValid()) {
109-
emit finished(403, tr("Could not add or remove user %1 to access folder %2").arg(_folderUserId).arg(_fullRemotePath));
111+
emit finished(403, tr("Could not add or remove user %1 to access folder %2").arg(_folderUserDisplayName).arg(_fullRemotePath));
110112
return;
111113
}
112114
startUpdate();

src/libsync/updatee2eefolderusersmetadatajob.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,15 @@ class OWNCLOUDSYNC_EXPORT UpdateE2eeFolderUsersMetadataJob : public QObject
3333
QString password;
3434
};
3535

36-
explicit UpdateE2eeFolderUsersMetadataJob(const AccountPtr &account, SyncJournalDb *journalDb,const QString &syncFolderRemotePath, const Operation operation, const QString &fullRemotePath = {}, const QString &folderUserId = {}, const QSslCertificate &certificate = QSslCertificate{}, QObject *parent = nullptr);
36+
explicit UpdateE2eeFolderUsersMetadataJob(const AccountPtr &account,
37+
SyncJournalDb *journalDb,
38+
const QString &syncFolderRemotePath,
39+
const Operation operation,
40+
const QString &fullRemotePath = {},
41+
const QString &folderUserId = {},
42+
const QString &folderUserDisplayName = {},
43+
const QSslCertificate &certificate = QSslCertificate{},
44+
QObject *parent = nullptr);
3745
~UpdateE2eeFolderUsersMetadataJob() override = default;
3846

3947
public:
@@ -84,6 +92,7 @@ private: signals:
8492
Operation _operation = Invalid;
8593
QString _fullRemotePath;
8694
QString _folderUserId;
95+
QString _folderUserDisplayName;
8796
QSslCertificate _folderUserCertificate;
8897
QByteArray _folderToken;
8998
// needed when re-encrypting nested folders' metadata after top-level folder's metadata has changed

src/libsync/updatemigratede2eemetadatajob.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ void UpdateMigratedE2eeMetadataJob::start()
3838
UpdateE2eeFolderUsersMetadataJob::Add,
3939
_fullRemotePath,
4040
propagator()->account()->davUser(),
41+
propagator()->account()->displayName(),
4142
propagator()->account()->e2e()->getCertificate());
4243
updateMedatadaAndSubfoldersJob->setParent(this);
4344
updateMedatadaAndSubfoldersJob->setSubJobSyncItems(_subJobItems);

0 commit comments

Comments
 (0)