Make DetailError different from BlacklistedError
authorChristian Kamm <mail@ckamm.de>
Wed, 12 Jul 2017 10:38:53 +0000 (12:38 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Thu, 5 Oct 2017 20:01:32 +0000 (22:01 +0200)
It's quite different in regard to blacklist handling and overall
sync failure changes.

src/gui/protocolwidget.cpp
src/libsync/owncloudpropagator.cpp
src/libsync/progressdispatcher.cpp
src/libsync/propagatedownload.cpp
src/libsync/propagateupload.cpp
src/libsync/syncfileitem.h
src/libsync/syncfilestatustracker.cpp

index b2c82ce3c306e4d4a8585ad555b04071c687c00d..75b8aaa5290e68ff55562f6ab0d8fd8851d85902 100644 (file)
@@ -147,6 +147,7 @@ QTreeWidgetItem *ProtocolWidget::createCompletedTreewidgetItem(const QString &fo
     QIcon icon;
     if (item._status == SyncFileItem::NormalError
         || item._status == SyncFileItem::FatalError
+        || item._status == SyncFileItem::DetailError
         || item._status == SyncFileItem::BlacklistedError) {
         icon = Theme::instance()->syncStateIcon(SyncResult::Error);
     } else if (Progress::isWarningKind(item._status)) {
index 2dcc7a26d5e7940dc698c34a96745ad14f3d3ce0..65fd70264f6a2afb5be3a7093758fc5e03cc662c 100644 (file)
@@ -172,7 +172,8 @@ static void blacklistUpdate(SyncJournalDb *journal, SyncFileItem &item)
     bool mayBlacklist =
         item._errorMayBeBlacklisted // explicitly flagged for blacklisting
         || ((item._status == SyncFileItem::NormalError
-                || item._status == SyncFileItem::SoftError)
+                || item._status == SyncFileItem::SoftError
+                || item._status == SyncFileItem::DetailError)
                && item._httpErrorCode != 0 // or non-local error
                );
 
@@ -239,13 +240,9 @@ void PropagateItemJob::done(SyncFileItem::Status statusArg, const QString &error
     case SyncFileItem::SoftError:
     case SyncFileItem::FatalError:
     case SyncFileItem::NormalError:
-    case SyncFileItem::BlacklistedError:
+    case SyncFileItem::DetailError:
         // Check the blacklist, possibly adjusting the item (including its status)
-        // but not if this status comes from blacklisting in the first place
-        if (!(_item->_status == SyncFileItem::BlacklistedError
-                && _item->_instruction == CSYNC_INSTRUCTION_IGNORE)) {
-            blacklistUpdate(propagator()->_journal, *_item);
-        }
+        blacklistUpdate(propagator()->_journal, *_item);
         break;
     case SyncFileItem::Success:
     case SyncFileItem::Restoration:
@@ -261,6 +258,7 @@ void PropagateItemJob::done(SyncFileItem::Status statusArg, const QString &error
     case SyncFileItem::Conflict:
     case SyncFileItem::FileIgnored:
     case SyncFileItem::NoStatus:
+    case SyncFileItem::BlacklistedError:
         // nothing
         break;
     }
@@ -805,7 +803,8 @@ void PropagatorCompositeJob::slotSubJobFinished(SyncFileItem::Status status)
 
     if (status == SyncFileItem::FatalError
         || status == SyncFileItem::NormalError
-        || status == SyncFileItem::SoftError) {
+        || status == SyncFileItem::SoftError
+        || status == SyncFileItem::DetailError) {
         _hasError = status;
     }
 
index d5b3f20f5027ad547f0bb658c04336f1466c9f65..df6417e4ada02b01851293e3b8440433ad532767 100644 (file)
@@ -91,7 +91,7 @@ bool Progress::isWarningKind(SyncFileItem::Status kind)
     return kind == SyncFileItem::SoftError || kind == SyncFileItem::NormalError
         || kind == SyncFileItem::FatalError || kind == SyncFileItem::FileIgnored
         || kind == SyncFileItem::Conflict || kind == SyncFileItem::Restoration
-        || kind == SyncFileItem::BlacklistedError;
+        || kind == SyncFileItem::DetailError || kind == SyncFileItem::BlacklistedError;
 }
 
 bool Progress::isIgnoredKind(SyncFileItem::Status kind)
index f5b1990249b0c97d5b874f90e146787e0ff3fec6..e98278e0c3ffaffad7b012cc942543b1afba252e 100644 (file)
@@ -429,10 +429,10 @@ void PropagateDownloadFile::startDownload()
     const auto diskSpaceResult = propagator()->diskSpaceCheck();
     if (diskSpaceResult != OwncloudPropagator::DiskSpaceOk) {
         if (diskSpaceResult == OwncloudPropagator::DiskSpaceFailure) {
-            // Using BlacklistedError here will make the error not pop up in the account
+            // Using DetailError here will make the error not pop up in the account
             // tab: instead we'll generate a general "disk space low" message and show
             // these detail errors only in the error view.
-            done(SyncFileItem::BlacklistedError,
+            done(SyncFileItem::DetailError,
                 tr("The download would reduce free local disk space below the limit"));
             emit propagator()->insufficientLocalStorage();
         } else if (diskSpaceResult == OwncloudPropagator::DiskSpaceCritical) {
index ac6c6825950ee504aef513907c87f306bfd856d4..73002c427ed205403e9638def482d3cdd56db91a 100644 (file)
@@ -524,8 +524,7 @@ void PropagateUploadFileCommon::commonErrorHandling(AbstractNetworkJob *job)
 
     if (_item->_httpErrorCode == 507) {
         // Insufficient remote storage.
-        _item->_errorMayBeBlacklisted = true;
-        status = SyncFileItem::BlacklistedError;
+        status = SyncFileItem::DetailError;
         errorString = tr("Upload of %1 exceeds the quota for the folder").arg(Utility::octetsToString(_item->_size));
         emit propagator()->insufficientRemoteStorage();
     }
index 571eabc19d6dbdb4e17323f9cded05de54990753..45660f83fd733c7a55b29c3dbd8a8a87adc4dda9 100644 (file)
@@ -64,12 +64,24 @@ public:
         FileIgnored, ///< The file is in the ignored list (or blacklisted with no retries left)
         Restoration, ///< The file was restored because what should have been done was not allowed
 
-        /** For files whose errors were blacklisted.
+        /** For errors that should only appear in the error view.
          *
-         * If _instruction == IGNORE, the file wasn't even reattempted.
+         * Some errors also produce a summary message. Usually displaying that message is
+         * sufficient, but the individual errors should still appear in the issues tab.
          *
-         * These errors should usually be shown as NormalErrors, but not be as loud
-         * as them.
+         * These errors do cause the sync to fail.
+         *
+         * A NormalError that isn't as prominent.
+         */
+        DetailError,
+
+        /** For files whose errors were blacklisted
+         *
+         * If an file is blacklisted due to an error it isn't even reattempted. These
+         * errors should appear in the issues tab, but not on the account settings and
+         * should not cause the sync run to fail.
+         *
+         * A DetailError that doesn't cause sync failure.
          */
         BlacklistedError
     };
index 32e3ccb004b3412426165c3687a2e50d53f12261..c0b3153729748ca0c8fc15f251d8f353f6ae1359 100644 (file)
@@ -94,6 +94,7 @@ static inline bool showErrorInSocketApi(const SyncFileItem &item)
     return item._instruction == CSYNC_INSTRUCTION_ERROR
         || status == SyncFileItem::NormalError
         || status == SyncFileItem::FatalError
+        || status == SyncFileItem::DetailError
         || status == SyncFileItem::BlacklistedError
         || item._hasBlacklistEntry;
 }