Skip to content

Commit

Permalink
Do not notify if setting is not enabled for folders going over limit
Browse files Browse the repository at this point in the history
Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Jul 4, 2023
1 parent 9522539 commit d707677
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/libsync/discoveryphase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/

#include "discoveryphase.h"
#include "configfile.h"
#include "discovery.h"
#include "helpers.h"
#include "progressdispatcher.h"
Expand Down Expand Up @@ -87,6 +88,11 @@ bool DiscoveryPhase::activeFolderSizeLimit() const
return _syncOptions._newBigFolderSizeLimit > 0 && _syncOptions._vfs->mode() == Vfs::Off;
}

bool DiscoveryPhase::notifyExistingFolderOverLimit() const
{
return activeFolderSizeLimit() && ConfigFile().notifyExistingFoldersOverLimit();
}

void DiscoveryPhase::checkFolderSizeLimit(const QString &path, const std::function<void(bool)> completionCallback)
{
if (!activeFolderSizeLimit()) {
Expand Down Expand Up @@ -152,9 +158,8 @@ void DiscoveryPhase::checkSelectiveSyncNewFolder(const QString &path,

void DiscoveryPhase::checkSelectiveSyncExistingFolder(const QString &path)
{
// TODO: Check for setting to obey big folder sync
// If no size limit is enforced, or if is in whitelist (explicitly allowed) or in blacklist (explicitly disallowed), do nothing.
if (!activeFolderSizeLimit() || findPathInList(_selectiveSyncWhiteList, path) || findPathInList(_selectiveSyncBlackList, path)) {
if (!notifyExistingFolderOverLimit() || findPathInList(_selectiveSyncWhiteList, path) || findPathInList(_selectiveSyncBlackList, path)) {
return;
}

Expand Down
3 changes: 2 additions & 1 deletion src/libsync/discoveryphase.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ class DiscoveryPhase : public QObject
[[nodiscard]] bool isInSelectiveSyncBlackList(const QString &path) const;

[[nodiscard]] bool activeFolderSizeLimit() const;

[[nodiscard]] bool notifyExistingFolderOverLimit() const;

void checkFolderSizeLimit(const QString &path,
const std::function<void(bool)> callback);

Expand Down

0 comments on commit d707677

Please sign in to comment.