Explorar o código

Merge pull request #5472 from nextcloud/work/fix-infinite-loading-share-dialog-disabled-share-links

Fix infinite loading in the share dialog when public link shares are disabled on the server
Claudio Cambra %!s(int64=3) %!d(string=hai) anos
pai
achega
33e1a900ad
Modificáronse 1 ficheiros con 4 adicións e 8 borrados
  1. 4 8
      src/gui/filedetails/sharemodel.cpp

+ 4 - 8
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;
     }
@@ -345,9 +342,11 @@ void ShareModel::handlePlaceholderLinkShare()
 
     if (linkSharePresent && placeholderLinkSharePresent) {
         slotRemoveShareWithId(placeholderLinkShareId);
-    } else if (!linkSharePresent && !placeholderLinkSharePresent) {
+    } else if (!linkSharePresent && !placeholderLinkSharePresent && publicLinkSharesEnabled()) {
         slotAddShare(_placeholderLinkShare);
     }
+
+    Q_EMIT sharesChanged();
 }
 
 void ShareModel::slotPropfindReceived(const QVariantMap &result)
@@ -481,7 +480,6 @@ void ShareModel::slotAddShare(const SharePtr &share)
     }
 
     handlePlaceholderLinkShare();
-    Q_EMIT sharesChanged();
 }
 
 void ShareModel::slotRemoveShareWithId(const QString &shareId)
@@ -508,8 +506,6 @@ void ShareModel::slotRemoveShareWithId(const QString &shareId)
     endRemoveRows();
 
     handlePlaceholderLinkShare();
-
-    Q_EMIT sharesChanged();
 }
 
 void ShareModel::slotServerError(const int code, const QString &message)