{"action":"created","comment":{"url":"https://api.github.com/repos/haiwen/seafile-client/pulls/comments/25995034","id":25995034,"diff_hunk":"@@ -207,3 +204,41 @@ Account AccountManager::getAccountBySignature(const QString& account_sig) const\n \n     return Account();\n }\n+\n+void AccountManager::updateServerInfo()\n+{\n+    for (size_t i = 0; i < accounts_.size(); i++)\n+        updateServerInfo(i);\n+}\n+\n+void AccountManager::updateServerInfo(unsigned index)\n+{\n+    ServerInfoRequest *request;\n+    // request is taken owner by Account object\n+    request = accounts_[index].createServerInfoRequest();\n+    connect(request, SIGNAL(success(const Account&, const ServerInfo &)),\n+            this, SLOT(serverInfoSuccess(const Account&, const ServerInfo &)));\n+    connect(request, SIGNAL(failed(const ApiError&)),\n+            this, SLOT(serverInfoFailed(const ApiError&)));\n+    request->send();\n+}\n+\n+\n+void AccountManager::serverInfoSuccess(const Account &account, const ServerInfo &info)\n+{\n+    for (size_t i = 0; i < accounts_.size(); i++) {\n+        if (accounts_[i] == account) {\n+            if (i == 0)\n+                emit beforeAccountChanged();\n+            accounts_[i].serverInfo = info;\n+            if (i == 0)\n+                emit accountsChanged();","path":"src/account-mgr.cpp","position":90,"original_position":90,"commit_id":"ac8c8157f01ff25add7ab1389a219b938cfd317d","original_commit_id":"b4b7df9e9e0e7dd4bc7cde7ea9ddf59a9960b6cc","user":{"login":"lins05","id":717363,"avatar_url":"https://avatars.githubusercontent.com/u/717363?v=3","gravatar_id":"","url":"https://api.github.com/users/lins05","html_url":"https://github.com/lins05","followers_url":"https://api.github.com/users/lins05/followers","following_url":"https://api.github.com/users/lins05/following{/other_user}","gists_url":"https://api.github.com/users/lins05/gists{/gist_id}","starred_url":"https://api.github.com/users/lins05/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lins05/subscriptions","organizations_url":"https://api.github.com/users/lins05/orgs","repos_url":"https://api.github.com/users/lins05/repos","events_url":"https://api.github.com/users/lins05/events{/privacy}","received_events_url":"https://api.github.com/users/lins05/received_events","type":"User","site_admin":false},"body":"As I mentioned, emitting `accountChanged` signal here would cause unnecessary operations on other modules which connects to this signal. For example, the avatar module would clear the in-memory cache of avatars, and the seahub notification module would send a request immediately to query unread notifications. \r\n\r\nTo avoid these, my suggestion is: add another signal `accountInfoUpdated`, and emit this signal instead of `accountChanged`. account-view.cpp should listen to this new signal, so that the other modules would not be affected. The `accountChanged` signal is designed to be used when the user switches to another account.\r\n\r\n> But if we use extra signals, it will involve a lot of complexities when you need to detect whether it has pro feature, and add extra code there.\r\n\r\nI see your consideration here. But I don't think there are many places in the code where we need to write these possible extra code.\r\n\r\n","created_at":"2015-03-07T10:14:50Z","updated_at":"2015-03-07T10:14:50Z","html_url":"https://github.com/haiwen/seafile-client/pull/478#discussion_r25995034","pull_request_url":"https://api.github.com/repos/haiwen/seafile-client/pulls/478","_links":{"self":{"href":"https://api.github.com/repos/haiwen/seafile-client/pulls/comments/25995034"},"html":{"href":"https://github.com/haiwen/seafile-client/pull/478#discussion_r25995034"},"pull_request":{"href":"https://api.github.com/repos/haiwen/seafile-client/pulls/478"}}},"pull_request":{"url":"https://api.github.com/repos/haiwen/seafile-client/pulls/478","id":30446920,"html_url":"https://github.com/haiwen/seafile-client/pull/478","diff_url":"https://github.com/haiwen/seafile-client/pull/478.diff","patch_url":"https://github.com/haiwen/seafile-client/pull/478.patch","issue_url":"https://api.github.com/repos/haiwen/seafile-client/issues/478","number":478,"state":"open","locked":false,"title":"implement server-info support","user":{"login":"Chilledheart","id":2123461,"avatar_url":"https://avatars.githubusercontent.com/u/2123461?v=3","gravatar_id":"","url":"https://api.github.com/users/Chilledheart","html_url":"https://github.com/Chilledheart","followers_url":"https://api.github.com/users/Chilledheart/followers","following_url":"https://api.github.com/users/Chilledheart/following{/other_user}","gists_url":"https://api.github.com/users/Chilledheart/gists{/gist_id}","starred_url":"https://api.github.com/users/Chilledheart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Chilledheart/subscriptions","organizations_url":"https://api.github.com/users/Chilledheart/orgs","repos_url":"https://api.github.com/users/Chilledheart/repos","events_url":"https://api.github.com/users/Chilledheart/events{/privacy}","received_events_url":"https://api.github.com/users/Chilledheart/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-03-04T08:42:33Z","updated_at":"2015-03-07T10:14:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2b376d165c3a1699f7a68822cb0b307cf9e7bbe","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/haiwen/seafile-client/pulls/478/commits","review_comments_url":"https://api.github.com/repos/haiwen/seafile-client/pulls/478/comments","review_comment_url":"https://api.github.com/repos/haiwen/seafile-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/haiwen/seafile-client/issues/478/comments","statuses_url":"https://api.github.com/repos/haiwen/seafile-client/statuses/ac8c8157f01ff25add7ab1389a219b938cfd317d","head":{"label":"haiwen:support_server_info","ref":"support_server_info","sha":"ac8c8157f01ff25add7ab1389a219b938cfd317d","user":{"login":"haiwen","id":1948782,"avatar_url":"https://avatars.githubusercontent.com/u/1948782?v=3","gravatar_id":"","url":"https://api.github.com/users/haiwen","html_url":"https://github.com/haiwen","followers_url":"https://api.github.com/users/haiwen/followers","following_url":"https://api.github.com/users/haiwen/following{/other_user}","gists_url":"https://api.github.com/users/haiwen/gists{/gist_id}","starred_url":"https://api.github.com/users/haiwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haiwen/subscriptions","organizations_url":"https://api.github.com/users/haiwen/orgs","repos_url":"https://api.github.com/users/haiwen/repos","events_url":"https://api.github.com/users/haiwen/events{/privacy}","received_events_url":"https://api.github.com/users/haiwen/received_events","type":"Organization","site_admin":false},"repo":{"id":11894308,"name":"seafile-client","full_name":"haiwen/seafile-client","owner":{"login":"haiwen","id":1948782,"avatar_url":"https://avatars.githubusercontent.com/u/1948782?v=3","gravatar_id":"","url":"https://api.github.com/users/haiwen","html_url":"https://github.com/haiwen","followers_url":"https://api.github.com/users/haiwen/followers","following_url":"https://api.github.com/users/haiwen/following{/other_user}","gists_url":"https://api.github.com/users/haiwen/gists{/gist_id}","starred_url":"https://api.github.com/users/haiwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haiwen/subscriptions","organizations_url":"https://api.github.com/users/haiwen/orgs","repos_url":"https://api.github.com/users/haiwen/repos","events_url":"https://api.github.com/users/haiwen/events{/privacy}","received_events_url":"https://api.github.com/users/haiwen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/haiwen/seafile-client","description":"Seafile desktop client.","fork":false,"url":"https://api.github.com/repos/haiwen/seafile-client","forks_url":"https://api.github.com/repos/haiwen/seafile-client/forks","keys_url":"https://api.github.com/repos/haiwen/seafile-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haiwen/seafile-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haiwen/seafile-client/teams","hooks_url":"https://api.github.com/repos/haiwen/seafile-client/hooks","issue_events_url":"https://api.github.com/repos/haiwen/seafile-client/issues/events{/number}","events_url":"https://api.github.com/repos/haiwen/seafile-client/events","assignees_url":"https://api.github.com/repos/haiwen/seafile-client/assignees{/user}","branches_url":"https://api.github.com/repos/haiwen/seafile-client/branches{/branch}","tags_url":"https://api.github.com/repos/haiwen/seafile-client/tags","blobs_url":"https://api.github.com/repos/haiwen/seafile-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haiwen/seafile-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haiwen/seafile-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/haiwen/seafile-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haiwen/seafile-client/statuses/{sha}","languages_url":"https://api.github.com/repos/haiwen/seafile-client/languages","stargazers_url":"https://api.github.com/repos/haiwen/seafile-client/stargazers","contributors_url":"https://api.github.com/repos/haiwen/seafile-client/contributors","subscribers_url":"https://api.github.com/repos/haiwen/seafile-client/subscribers","subscription_url":"https://api.github.com/repos/haiwen/seafile-client/subscription","commits_url":"https://api.github.com/repos/haiwen/seafile-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/haiwen/seafile-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/haiwen/seafile-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/haiwen/seafile-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/haiwen/seafile-client/contents/{+path}","compare_url":"https://api.github.com/repos/haiwen/seafile-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haiwen/seafile-client/merges","archive_url":"https://api.github.com/repos/haiwen/seafile-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haiwen/seafile-client/downloads","issues_url":"https://api.github.com/repos/haiwen/seafile-client/issues{/number}","pulls_url":"https://api.github.com/repos/haiwen/seafile-client/pulls{/number}","milestones_url":"https://api.github.com/repos/haiwen/seafile-client/milestones{/number}","notifications_url":"https://api.github.com/repos/haiwen/seafile-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haiwen/seafile-client/labels{/name}","releases_url":"https://api.github.com/repos/haiwen/seafile-client/releases{/id}","created_at":"2013-08-05T09:08:07Z","updated_at":"2015-03-07T10:01:57Z","pushed_at":"2015-03-07T10:01:56Z","git_url":"git://github.com/haiwen/seafile-client.git","ssh_url":"git@github.com:haiwen/seafile-client.git","clone_url":"https://github.com/haiwen/seafile-client.git","svn_url":"https://github.com/haiwen/seafile-client","homepage":"http://seafile.com","size":17824,"stargazers_count":76,"watchers_count":76,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":93,"forks":73,"open_issues":93,"watchers":76,"default_branch":"master"}},"base":{"label":"haiwen:4.1","ref":"4.1","sha":"8ac106fa3ed53d03120c886555bc8b6a4ab35fbb","user":{"login":"haiwen","id":1948782,"avatar_url":"https://avatars.githubusercontent.com/u/1948782?v=3","gravatar_id":"","url":"https://api.github.com/users/haiwen","html_url":"https://github.com/haiwen","followers_url":"https://api.github.com/users/haiwen/followers","following_url":"https://api.github.com/users/haiwen/following{/other_user}","gists_url":"https://api.github.com/users/haiwen/gists{/gist_id}","starred_url":"https://api.github.com/users/haiwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haiwen/subscriptions","organizations_url":"https://api.github.com/users/haiwen/orgs","repos_url":"https://api.github.com/users/haiwen/repos","events_url":"https://api.github.com/users/haiwen/events{/privacy}","received_events_url":"https://api.github.com/users/haiwen/received_events","type":"Organization","site_admin":false},"repo":{"id":11894308,"name":"seafile-client","full_name":"haiwen/seafile-client","owner":{"login":"haiwen","id":1948782,"avatar_url":"https://avatars.githubusercontent.com/u/1948782?v=3","gravatar_id":"","url":"https://api.github.com/users/haiwen","html_url":"https://github.com/haiwen","followers_url":"https://api.github.com/users/haiwen/followers","following_url":"https://api.github.com/users/haiwen/following{/other_user}","gists_url":"https://api.github.com/users/haiwen/gists{/gist_id}","starred_url":"https://api.github.com/users/haiwen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haiwen/subscriptions","organizations_url":"https://api.github.com/users/haiwen/orgs","repos_url":"https://api.github.com/users/haiwen/repos","events_url":"https://api.github.com/users/haiwen/events{/privacy}","received_events_url":"https://api.github.com/users/haiwen/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/haiwen/seafile-client","description":"Seafile desktop client.","fork":false,"url":"https://api.github.com/repos/haiwen/seafile-client","forks_url":"https://api.github.com/repos/haiwen/seafile-client/forks","keys_url":"https://api.github.com/repos/haiwen/seafile-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haiwen/seafile-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haiwen/seafile-client/teams","hooks_url":"https://api.github.com/repos/haiwen/seafile-client/hooks","issue_events_url":"https://api.github.com/repos/haiwen/seafile-client/issues/events{/number}","events_url":"https://api.github.com/repos/haiwen/seafile-client/events","assignees_url":"https://api.github.com/repos/haiwen/seafile-client/assignees{/user}","branches_url":"https://api.github.com/repos/haiwen/seafile-client/branches{/branch}","tags_url":"https://api.github.com/repos/haiwen/seafile-client/tags","blobs_url":"https://api.github.com/repos/haiwen/seafile-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haiwen/seafile-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haiwen/seafile-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/haiwen/seafile-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haiwen/seafile-client/statuses/{sha}","languages_url":"https://api.github.com/repos/haiwen/seafile-client/languages","stargazers_url":"https://api.github.com/repos/haiwen/seafile-client/stargazers","contributors_url":"https://api.github.com/repos/haiwen/seafile-client/contributors","subscribers_url":"https://api.github.com/repos/haiwen/seafile-client/subscribers","subscription_url":"https://api.github.com/repos/haiwen/seafile-client/subscription","commits_url":"https://api.github.com/repos/haiwen/seafile-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/haiwen/seafile-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/haiwen/seafile-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/haiwen/seafile-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/haiwen/seafile-client/contents/{+path}","compare_url":"https://api.github.com/repos/haiwen/seafile-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haiwen/seafile-client/merges","archive_url":"https://api.github.com/repos/haiwen/seafile-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haiwen/seafile-client/downloads","issues_url":"https://api.github.com/repos/haiwen/seafile-client/issues{/number}","pulls_url":"https://api.github.com/repos/haiwen/seafile-client/pulls{/number}","milestones_url":"https://api.github.com/repos/haiwen/seafile-client/milestones{/number}","notifications_url":"https://api.github.com/repos/haiwen/seafile-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haiwen/seafile-client/labels{/name}","releases_url":"https://api.github.com/repos/haiwen/seafile-client/releases{/id}","created_at":"2013-08-05T09:08:07Z","updated_at":"2015-03-07T10:01:57Z","pushed_at":"2015-03-07T10:01:56Z","git_url":"git://github.com/haiwen/seafile-client.git","ssh_url":"git@github.com:haiwen/seafile-client.git","clone_url":"https://github.com/haiwen/seafile-client.git","svn_url":"https://github.com/haiwen/seafile-client","homepage":"http://seafile.com","size":17824,"stargazers_count":76,"watchers_count":76,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":73,"mirror_url":null,"open_issues_count":93,"forks":73,"open_issues":93,"watchers":76,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/haiwen/seafile-client/pulls/478"},"html":{"href":"https://github.com/haiwen/seafile-client/pull/478"},"issue":{"href":"https://api.github.com/repos/haiwen/seafile-client/issues/478"},"comments":{"href":"https://api.github.com/repos/haiwen/seafile-client/issues/478/comments"},"review_comments":{"href":"https://api.github.com/repos/haiwen/seafile-client/pulls/478/comments"},"review_comment":{"href":"https://api.github.com/repos/haiwen/seafile-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/haiwen/seafile-client/pulls/478/commits"},"statuses":{"href":"https://api.github.com/repos/haiwen/seafile-client/statuses/ac8c8157f01ff25add7ab1389a219b938cfd317d"}}}}