Skip to content

Commit

Permalink
avoid displaying the same encryption error twice
Browse files Browse the repository at this point in the history
remove duplicated handling of the same server error

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
  • Loading branch information
mgallien committed Dec 5, 2024
1 parent fbb8aed commit d9213ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
23 changes: 10 additions & 13 deletions src/gui/filedetails/sharemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,12 @@ void ShareModel::initShareManager()
connect(_manager.data(), &ShareManager::linkShareCreated, this, &ShareModel::slotAddShare);
connect(_manager.data(), &ShareManager::linkShareRequiresPassword, this, &ShareModel::requestPasswordForLinkShare);
connect(_manager.data(), &ShareManager::serverError, this, [this](const int code, const QString &message) {
_hasInitialShareFetchCompleted = true;
Q_EMIT hasInitialShareFetchCompletedChanged();
if (!_hasInitialShareFetchCompleted) {
_hasInitialShareFetchCompleted = true;
Q_EMIT hasInitialShareFetchCompletedChanged();
}

qCWarning(lcShareModel) << "Error from server from ShareManager class and initShareManager" << code << message;
emit serverError(code, message);
});

Expand Down Expand Up @@ -633,7 +637,10 @@ void ShareModel::slotAddShare(const SharePtr &share)
const QPersistentModelIndex sharePersistentIndex(shareModelIndex);
_shareIdIndexHash.insert(shareId, sharePersistentIndex);

connect(share.data(), &Share::serverError, this, &ShareModel::slotServerError);
connect(share.data(), &Share::serverError, this, [this] (int code, const QString &message) {
qCWarning(lcShareModel) << "Error from server from Share class" << code << message;
Q_EMIT serverError(code, message);
});
connect(share.data(), &Share::passwordSetError, this, [this, shareId](const int code, const QString &message) {
_shareIdRecentlySetPasswords.remove(shareId);
slotSharePasswordSet(shareId);
Expand All @@ -656,10 +663,6 @@ void ShareModel::slotAddShare(const SharePtr &share)
connect(userGroupShare.data(), &UserGroupShare::expireDateSet, this, [this, shareId]{ slotShareExpireDateSet(shareId); });
}

if (_manager) {
connect(_manager.data(), &ShareManager::serverError, this, &ShareModel::slotServerError);
}

handleLinkShare();
Q_EMIT sharesChanged();
}
Expand Down Expand Up @@ -708,12 +711,6 @@ void ShareModel::slotRemoveShareWithId(const QString &shareId)
Q_EMIT sharesChanged();
}

void ShareModel::slotServerError(const int code, const QString &message)
{
qCWarning(lcShareModel) << "Error from server" << code << message;
Q_EMIT serverError(code, message);
}

void ShareModel::slotAddSharee(const ShareePtr &sharee)
{
if(!sharee) {
Expand Down
1 change: 0 additions & 1 deletion src/gui/filedetails/sharemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ private slots:
void setHideDownloadEnabledChangeInProgress(const QString &shareId, const bool isInProgress);

void slotPropfindReceived(const QVariantMap &result);
void slotServerError(const int code, const QString &message);
void slotAddShare(const OCC::SharePtr &share);
void slotRemoveShareWithId(const QString &shareId);
void slotSharesFetched(const QList<OCC::SharePtr> &shares);
Expand Down

0 comments on commit d9213ce

Please sign in to comment.