Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check synced db before check if unsync repo #1578

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 27 additions & 25 deletions src/repo-service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,34 +286,36 @@ void RepoService::onRefreshSuccess(const std::vector<ServerRepo>& 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);
}
}

Expand Down