From 356026347295e5d01dec0dc1400379070348525e Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Fri, 24 Feb 2023 13:40:17 +0100 Subject: [PATCH 1/3] Don't block loading if public link shares are disabled Signed-off-by: Claudio Cambra --- src/gui/filedetails/sharemodel.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index f8422cce7dab7..13190a802e310 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -298,10 +298,7 @@ void ShareModel::initShareManager() } bool sharingPossible = true; - if (!publicLinkSharesEnabled()) { - qCWarning(lcSharing) << "Link shares have been disabled"; - sharingPossible = false; - } else if (!canShare()) { + if (!canShare()) { qCWarning(lcSharing) << "The file cannot be shared because it does not have sharing permission."; sharingPossible = false; } From f05e44a24a93e45ec5beb78fe3552cc137d72771 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Fri, 24 Feb 2023 13:40:58 +0100 Subject: [PATCH 2/3] Don't display the placeholder link share of public link shares are not available Signed-off-by: Claudio Cambra --- src/gui/filedetails/sharemodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index 13190a802e310..178cda3d5745f 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -342,7 +342,7 @@ void ShareModel::handlePlaceholderLinkShare() if (linkSharePresent && placeholderLinkSharePresent) { slotRemoveShareWithId(placeholderLinkShareId); - } else if (!linkSharePresent && !placeholderLinkSharePresent) { + } else if (!linkSharePresent && !placeholderLinkSharePresent && publicLinkSharesEnabled()) { slotAddShare(_placeholderLinkShare); } } @@ -402,6 +402,7 @@ void ShareModel::slotSharesFetched(const QList &shares) } handlePlaceholderLinkShare(); + Q_EMIT sharesChanged(); } void ShareModel::setupInternalLinkShare() From 2e69a9c59a743db3d47e01ebcbc5774a073fe4d8 Mon Sep 17 00:00:00 2001 From: Claudio Cambra Date: Tue, 28 Feb 2023 23:18:05 +0100 Subject: [PATCH 3/3] Move sharesChanged signal emission to handlePlaceholderLinkShare rather than repeating each time this method is called Signed-off-by: Claudio Cambra --- src/gui/filedetails/sharemodel.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gui/filedetails/sharemodel.cpp b/src/gui/filedetails/sharemodel.cpp index 178cda3d5745f..7b374345056f6 100644 --- a/src/gui/filedetails/sharemodel.cpp +++ b/src/gui/filedetails/sharemodel.cpp @@ -345,6 +345,8 @@ void ShareModel::handlePlaceholderLinkShare() } else if (!linkSharePresent && !placeholderLinkSharePresent && publicLinkSharesEnabled()) { slotAddShare(_placeholderLinkShare); } + + Q_EMIT sharesChanged(); } void ShareModel::slotPropfindReceived(const QVariantMap &result) @@ -402,7 +404,6 @@ void ShareModel::slotSharesFetched(const QList &shares) } handlePlaceholderLinkShare(); - Q_EMIT sharesChanged(); } void ShareModel::setupInternalLinkShare() @@ -479,7 +480,6 @@ void ShareModel::slotAddShare(const SharePtr &share) } handlePlaceholderLinkShare(); - Q_EMIT sharesChanged(); } void ShareModel::slotRemoveShareWithId(const QString &shareId) @@ -506,8 +506,6 @@ void ShareModel::slotRemoveShareWithId(const QString &shareId) endRemoveRows(); handlePlaceholderLinkShare(); - - Q_EMIT sharesChanged(); } void ShareModel::slotServerError(const int code, const QString &message)