{"action":"created","comment":{"url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/comments/29089389","id":29089389,"diff_hunk":"@@ -243,19 +243,17 @@ FirebaseSocialProvider.prototype.addUserProfile_ = function(friend) {\n   // about a client when they send us the first message (e.g. instance message\n   // in the case of uProxy).\n   var clients = new Firebase(this.getClientsUrl_(friend.userId));\n-  clients.on('value', function(value) {\n-    // TODO: this is going to be updating the lastUpdated and lastSeen values\n-    // for each client, any time any of the clients change!\n-    // i.e. if there are only 2 clients A and B, then C gets added, this will be\n-    // invoked with A, B, and C..  Find a way to only pay attention to C.\n-    // possibly using some combination of child_added and child_changed instead\n-    // of value.\n-    // See: https://www.firebase.com/docs/web/api/query/on.html\n-    value.forEach(function(snapshot) {\n-      var clientId = friend.userId + '/' + snapshot.key();\n-      var status = snapshot.val() == 'ONLINE' ? 'ONLINE' : 'OFFLINE';\n-      this.addOrUpdateClient_(friend.userId, clientId, status);\n-    }.bind(this));\n+  clients.on('child_added', function(snapshot) {","path":"src/firebase-social-provider.js","position":17,"original_position":17,"commit_id":"3b61be6666f2bae89998c33315ea455772bb5a0b","original_commit_id":"3b61be6666f2bae89998c33315ea455772bb5a0b","user":{"login":"soycode","id":587921,"avatar_url":"https://avatars.githubusercontent.com/u/587921?v=3","gravatar_id":"","url":"https://api.github.com/users/soycode","html_url":"https://github.com/soycode","followers_url":"https://api.github.com/users/soycode/followers","following_url":"https://api.github.com/users/soycode/following{/other_user}","gists_url":"https://api.github.com/users/soycode/gists{/gist_id}","starred_url":"https://api.github.com/users/soycode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soycode/subscriptions","organizations_url":"https://api.github.com/users/soycode/orgs","repos_url":"https://api.github.com/users/soycode/repos","events_url":"https://api.github.com/users/soycode/events{/privacy}","received_events_url":"https://api.github.com/users/soycode/received_events","type":"User","site_admin":false},"body":"Was this potentially receiving other events of importance when it was on 'value' and not on 'child_added'?","created_at":"2015-04-24T21:59:36Z","updated_at":"2015-04-24T21:59:36Z","html_url":"https://github.com/freedomjs/freedom-social-firebase/pull/18#discussion_r29089389","pull_request_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/18","_links":{"self":{"href":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/comments/29089389"},"html":{"href":"https://github.com/freedomjs/freedom-social-firebase/pull/18#discussion_r29089389"},"pull_request":{"href":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/18","id":34089108,"html_url":"https://github.com/freedomjs/freedom-social-firebase/pull/18","diff_url":"https://github.com/freedomjs/freedom-social-firebase/pull/18.diff","patch_url":"https://github.com/freedomjs/freedom-social-firebase/pull/18.patch","issue_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/issues/18","number":18,"state":"open","locked":false,"title":"Emit OFFLINE client state for users who disconnect","user":{"login":"dborkan","id":6494307,"avatar_url":"https://avatars.githubusercontent.com/u/6494307?v=3","gravatar_id":"","url":"https://api.github.com/users/dborkan","html_url":"https://github.com/dborkan","followers_url":"https://api.github.com/users/dborkan/followers","following_url":"https://api.github.com/users/dborkan/following{/other_user}","gists_url":"https://api.github.com/users/dborkan/gists{/gist_id}","starred_url":"https://api.github.com/users/dborkan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dborkan/subscriptions","organizations_url":"https://api.github.com/users/dborkan/orgs","repos_url":"https://api.github.com/users/dborkan/repos","events_url":"https://api.github.com/users/dborkan/events{/privacy}","received_events_url":"https://api.github.com/users/dborkan/received_events","type":"User","site_admin":false},"body":"Fix for https://github.com/uProxy/uproxy/issues/1299.\r\n\r\nNow users who are OFFLINE will always remove their client record, regardless of whether they logout (through a call to .logout()) or disconnect (e.g. quit their browser).  We now listen to child_added and child_removed events, and can detect OFFLINE clients when we get a child_removed.\r\n\r\nTested in uProxy in Chrome.","created_at":"2015-04-24T21:47:50Z","updated_at":"2015-04-24T21:59:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e9243dab6e18d3a3561067decbc06895b152c82","assignee":{"login":"soycode","id":587921,"avatar_url":"https://avatars.githubusercontent.com/u/587921?v=3","gravatar_id":"","url":"https://api.github.com/users/soycode","html_url":"https://github.com/soycode","followers_url":"https://api.github.com/users/soycode/followers","following_url":"https://api.github.com/users/soycode/following{/other_user}","gists_url":"https://api.github.com/users/soycode/gists{/gist_id}","starred_url":"https://api.github.com/users/soycode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/soycode/subscriptions","organizations_url":"https://api.github.com/users/soycode/orgs","repos_url":"https://api.github.com/users/soycode/repos","events_url":"https://api.github.com/users/soycode/events{/privacy}","received_events_url":"https://api.github.com/users/soycode/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/18/commits","review_comments_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/18/comments","review_comment_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/comments{/number}","comments_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/issues/18/comments","statuses_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/statuses/3b61be6666f2bae89998c33315ea455772bb5a0b","head":{"label":"freedomjs:dborkan-offline","ref":"dborkan-offline","sha":"3b61be6666f2bae89998c33315ea455772bb5a0b","user":{"login":"freedomjs","id":5855670,"avatar_url":"https://avatars.githubusercontent.com/u/5855670?v=3","gravatar_id":"","url":"https://api.github.com/users/freedomjs","html_url":"https://github.com/freedomjs","followers_url":"https://api.github.com/users/freedomjs/followers","following_url":"https://api.github.com/users/freedomjs/following{/other_user}","gists_url":"https://api.github.com/users/freedomjs/gists{/gist_id}","starred_url":"https://api.github.com/users/freedomjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freedomjs/subscriptions","organizations_url":"https://api.github.com/users/freedomjs/orgs","repos_url":"https://api.github.com/users/freedomjs/repos","events_url":"https://api.github.com/users/freedomjs/events{/privacy}","received_events_url":"https://api.github.com/users/freedomjs/received_events","type":"Organization","site_admin":false},"repo":{"id":30378484,"name":"freedom-social-firebase","full_name":"freedomjs/freedom-social-firebase","owner":{"login":"freedomjs","id":5855670,"avatar_url":"https://avatars.githubusercontent.com/u/5855670?v=3","gravatar_id":"","url":"https://api.github.com/users/freedomjs","html_url":"https://github.com/freedomjs","followers_url":"https://api.github.com/users/freedomjs/followers","following_url":"https://api.github.com/users/freedomjs/following{/other_user}","gists_url":"https://api.github.com/users/freedomjs/gists{/gist_id}","starred_url":"https://api.github.com/users/freedomjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freedomjs/subscriptions","organizations_url":"https://api.github.com/users/freedomjs/orgs","repos_url":"https://api.github.com/users/freedomjs/repos","events_url":"https://api.github.com/users/freedomjs/events{/privacy}","received_events_url":"https://api.github.com/users/freedomjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/freedomjs/freedom-social-firebase","description":"Firebase Social Provider","fork":false,"url":"https://api.github.com/repos/freedomjs/freedom-social-firebase","forks_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/forks","keys_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/teams","hooks_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/hooks","issue_events_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/issues/events{/number}","events_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/events","assignees_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/assignees{/user}","branches_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/branches{/branch}","tags_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/tags","blobs_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/git/refs{/sha}","trees_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/statuses/{sha}","languages_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/languages","stargazers_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/stargazers","contributors_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/contributors","subscribers_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/subscribers","subscription_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/subscription","commits_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/commits{/sha}","git_commits_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/git/commits{/sha}","comments_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/comments{/number}","issue_comment_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/issues/comments{/number}","contents_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/contents/{+path}","compare_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/merges","archive_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/downloads","issues_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/issues{/number}","pulls_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls{/number}","milestones_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/milestones{/number}","notifications_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/labels{/name}","releases_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/releases{/id}","created_at":"2015-02-05T21:07:44Z","updated_at":"2015-04-17T20:17:11Z","pushed_at":"2015-04-24T21:47:50Z","git_url":"git://github.com/freedomjs/freedom-social-firebase.git","ssh_url":"git@github.com:freedomjs/freedom-social-firebase.git","clone_url":"https://github.com/freedomjs/freedom-social-firebase.git","svn_url":"https://github.com/freedomjs/freedom-social-firebase","homepage":"","size":596,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"base":{"label":"freedomjs:master","ref":"master","sha":"c294594694c3d5bbe1fe5a72b9cdcce61d0c6e26","user":{"login":"freedomjs","id":5855670,"avatar_url":"https://avatars.githubusercontent.com/u/5855670?v=3","gravatar_id":"","url":"https://api.github.com/users/freedomjs","html_url":"https://github.com/freedomjs","followers_url":"https://api.github.com/users/freedomjs/followers","following_url":"https://api.github.com/users/freedomjs/following{/other_user}","gists_url":"https://api.github.com/users/freedomjs/gists{/gist_id}","starred_url":"https://api.github.com/users/freedomjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freedomjs/subscriptions","organizations_url":"https://api.github.com/users/freedomjs/orgs","repos_url":"https://api.github.com/users/freedomjs/repos","events_url":"https://api.github.com/users/freedomjs/events{/privacy}","received_events_url":"https://api.github.com/users/freedomjs/received_events","type":"Organization","site_admin":false},"repo":{"id":30378484,"name":"freedom-social-firebase","full_name":"freedomjs/freedom-social-firebase","owner":{"login":"freedomjs","id":5855670,"avatar_url":"https://avatars.githubusercontent.com/u/5855670?v=3","gravatar_id":"","url":"https://api.github.com/users/freedomjs","html_url":"https://github.com/freedomjs","followers_url":"https://api.github.com/users/freedomjs/followers","following_url":"https://api.github.com/users/freedomjs/following{/other_user}","gists_url":"https://api.github.com/users/freedomjs/gists{/gist_id}","starred_url":"https://api.github.com/users/freedomjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freedomjs/subscriptions","organizations_url":"https://api.github.com/users/freedomjs/orgs","repos_url":"https://api.github.com/users/freedomjs/repos","events_url":"https://api.github.com/users/freedomjs/events{/privacy}","received_events_url":"https://api.github.com/users/freedomjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/freedomjs/freedom-social-firebase","description":"Firebase Social Provider","fork":false,"url":"https://api.github.com/repos/freedomjs/freedom-social-firebase","forks_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/forks","keys_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/keys{/key_id}","collaborators_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/teams","hooks_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/hooks","issue_events_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/issues/events{/number}","events_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/events","assignees_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/assignees{/user}","branches_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/branches{/branch}","tags_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/tags","blobs_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/git/refs{/sha}","trees_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/git/trees{/sha}","statuses_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/statuses/{sha}","languages_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/languages","stargazers_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/stargazers","contributors_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/contributors","subscribers_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/subscribers","subscription_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/subscription","commits_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/commits{/sha}","git_commits_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/git/commits{/sha}","comments_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/comments{/number}","issue_comment_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/issues/comments{/number}","contents_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/contents/{+path}","compare_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/compare/{base}...{head}","merges_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/merges","archive_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/downloads","issues_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/issues{/number}","pulls_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls{/number}","milestones_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/milestones{/number}","notifications_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/labels{/name}","releases_url":"https://api.github.com/repos/freedomjs/freedom-social-firebase/releases{/id}","created_at":"2015-02-05T21:07:44Z","updated_at":"2015-04-17T20:17:11Z","pushed_at":"2015-04-24T21:47:50Z","git_url":"git://github.com/freedomjs/freedom-social-firebase.git","ssh_url":"git@github.com:freedomjs/freedom-social-firebase.git","clone_url":"https://github.com/freedomjs/freedom-social-firebase.git","svn_url":"https://github.com/freedomjs/freedom-social-firebase","homepage":"","size":596,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":9,"forks":0,"open_issues":9,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/18"},"html":{"href":"https://github.com/freedomjs/freedom-social-firebase/pull/18"},"issue":{"href":"https://api.github.com/repos/freedomjs/freedom-social-firebase/issues/18"},"comments":{"href":"https://api.github.com/repos/freedomjs/freedom-social-firebase/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/freedomjs/freedom-social-firebase/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/freedomjs/freedom-social-firebase/statuses/3b61be6666f2bae89998c33315ea455772bb5a0b"}}}}