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

Only check server url when username is empty #1600

Merged
merged 3 commits into from
Feb 21, 2025
Merged

Only check server url when username is empty #1600

merged 3 commits into from
Feb 21, 2025

Conversation

feiniks
Copy link
Contributor

@feiniks feiniks commented Feb 19, 2025

No description provided.

if (rpc->getRepoProperty(repo_id, "username", &username) < 0) {
return Account();
for (size_t i = 0; i < accounts.size(); i++) {
Copy link
Member

@killing killing Feb 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个逻辑可以合并到下面的 for 循环里面吧。还需要注释一下,9.0.7 之前同步的资料库是没有 username 这个属性的。

@@ -105,19 +105,22 @@ QStringList collectSyncedReposForAccount(const Account& account)
LocalRepo repo = repos[i];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个函数的名字比较奇怪,函数名字的意思是获取账号下已同步的资料库列表,但是返回的却是没有 token 的已同步资料库。然后看一下只被一个函数调用,就是为没有 token 的资料库重新获取一下 token。

这个函数有什么用呢?什么情况下可能出现有的已同步资料库没有设置 token 属性?这个 token 正常是在什么时候设置到底层的 repo 属性里面的呢?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个应该是重新登录账号时用来更新 token 的,token 最开始应该是在 clone repo 时设置的。一般情况下应该都有这个 token 属性的。

@@ -105,19 +105,22 @@ QStringList collectSyncedReposForAccount(const Account& account)
LocalRepo repo = repos[i];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个函数的名字改为 collectSyncedReposWithoutToken 吧。同时,位置移动到调用位置附近吧。

@killing killing merged commit bdc6906 into master Feb 21, 2025
@killing killing deleted the fix_username branch February 21, 2025 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants