From bd76212d61cb14f982676e8e67db78e999a6ee1a Mon Sep 17 00:00:00 2001 From: yangheran Date: Tue, 12 Nov 2024 12:39:23 +0800 Subject: [PATCH] check synced db before check if unsync repo --- src/repo-service.cpp | 52 +++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/src/repo-service.cpp b/src/repo-service.cpp index a5f2095cb..0f8d752d5 100644 --- a/src/repo-service.cpp +++ b/src/repo-service.cpp @@ -286,34 +286,36 @@ void RepoService::onRefreshSuccess(const std::vector& repos) startGetRequestFor(synced_subfolders_[i].repoId()); } - const Account account = seafApplet->accountManager()->currentAccount(); - if (!account.isValid()) { - return; - } - for (size_t i = 0; i < local_repos_.size(); ++i) { - bool found = false; - const LocalRepo& repo = local_repos_[i]; - - // skip repos that do not belong to the current account - if (repo.account != account) { - continue; + if (synced_subfolder_db_) { + const Account account = seafApplet->accountManager()->currentAccount(); + if (!account.isValid()) { + return; } - for (size_t j = 0; j < server_repos_.size(); ++j) { - if (repo.id == server_repos_[j].id) { - found = true; - break; + for (size_t i = 0; i < local_repos_.size(); ++i) { + bool found = false; + const LocalRepo& repo = local_repos_[i]; + + // skip repos that do not belong to the current account + if (repo.account != account) { + continue; } - } - // skip synced subfolders - for (size_t j = 0; j < synced_subfolders_.size(); ++j) { - if (synced_subfolders_[j].repoId() == repo.id) { - found = true; - break; + for (size_t j = 0; j < server_repos_.size(); ++j) { + if (repo.id == server_repos_[j].id) { + found = true; + break; + } + } + // skip synced subfolders + for (size_t j = 0; j < synced_subfolders_.size(); ++j) { + if (synced_subfolders_[j].repoId() == repo.id) { + found = true; + break; + } + } + if (!found) { + qWarning ("unsync local library %s/%s because you don't have permission to access it\n", repo.id.toUtf8().data(), repo.name.toUtf8().data()); + seafApplet->rpcClient()->unsync(repo.id); } - } - if (!found) { - qWarning ("unsync local library %s/%s because you don't have permission to access it\n", repo.id.toUtf8().data(), repo.name.toUtf8().data()); - seafApplet->rpcClient()->unsync(repo.id); } }