{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/testdaybot/pulls/comments/22880481","id":22880481,"diff_hunk":"@@ -168,17 +157,36 @@ client.addListener('message', function(from, to, message) {\n     client.say(to, intro + scheduleTimes);\n   }\n \n+  if (message.search('[!:]optout') === 0) {\n+    if (!(from in optOut)) {\n+      optOut[from] = null;\n+      metrics.optOutTotal += 1;\n+      if (from in metrics.activeUsers) {\n+        delete metrics.activeUsers[from];\n+      }\n+    }\n+    client.say(from, \"You’ve opted out of Test Day data collection \" +\n+    \"for your nick \" + from + \".\");\n+  }\n+\n   if (testDay) {\n     if (from === 'firebot') {\n       if (message.search(/https:\\/\\/bugzilla.mozilla.org\\/show_bug.cgi\\?id=(\\d+)/i) >= 0) {\n         metrics.firebotBugs.push(/https:\\/\\/bugzilla.mozilla.org\\/show_bug.cgi\\?id=(\\d+)/i.exec(message)[1]);\n       }\n     }\n-    if (from in metrics.usersTalked) {\n-      metrics.usersTalked[from] += 1;\n-    } else {\n-      metrics.usersTalked[from] = 1;\n+\n+    // if from is not on the opt out list\n+    if (!(from in optOut)) {\n+      if (from in metrics.activeUsers) {\n+        metrics.activeUsers[from] += 1;\n+      } else {\n+        client.say(from, \"Welcome to today’s Test Day, \" + from + \"!\");\n+          client.say(from, \"To opt out of data collection, use the command :optout.\");\n+          metrics.activeUsers[from] = 1;","path":"bot.js","position":93,"original_position":93,"commit_id":"6cbb6dc1b9ebdcc33feb6edaa05f7a9c043dd0d0","original_commit_id":"6cbb6dc1b9ebdcc33feb6edaa05f7a9c043dd0d0","user":{"login":"whimboo","id":129603,"avatar_url":"https://avatars.githubusercontent.com/u/129603?v=3","gravatar_id":"","url":"https://api.github.com/users/whimboo","html_url":"https://github.com/whimboo","followers_url":"https://api.github.com/users/whimboo/followers","following_url":"https://api.github.com/users/whimboo/following{/other_user}","gists_url":"https://api.github.com/users/whimboo/gists{/gist_id}","starred_url":"https://api.github.com/users/whimboo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whimboo/subscriptions","organizations_url":"https://api.github.com/users/whimboo/orgs","repos_url":"https://api.github.com/users/whimboo/repos","events_url":"https://api.github.com/users/whimboo/events{/privacy}","received_events_url":"https://api.github.com/users/whimboo/received_events","type":"User","site_admin":false},"body":"nit: please fix the indentation.","created_at":"2015-01-13T17:59:33Z","updated_at":"2015-01-13T17:59:33Z","html_url":"https://github.com/mozilla/testdaybot/pull/46#discussion_r22880481","pull_request_url":"https://api.github.com/repos/mozilla/testdaybot/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/mozilla/testdaybot/pulls/comments/22880481"},"html":{"href":"https://github.com/mozilla/testdaybot/pull/46#discussion_r22880481"},"pull_request":{"href":"https://api.github.com/repos/mozilla/testdaybot/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/testdaybot/pulls/46","id":27247458,"html_url":"https://github.com/mozilla/testdaybot/pull/46","diff_url":"https://github.com/mozilla/testdaybot/pull/46.diff","patch_url":"https://github.com/mozilla/testdaybot/pull/46.patch","issue_url":"https://api.github.com/repos/mozilla/testdaybot/issues/46","number":46,"state":"open","locked":false,"title":"Log active participants, enable opt out from data collection","user":{"login":"galgeek","id":3253863,"avatar_url":"https://avatars.githubusercontent.com/u/3253863?v=3","gravatar_id":"","url":"https://api.github.com/users/galgeek","html_url":"https://github.com/galgeek","followers_url":"https://api.github.com/users/galgeek/followers","following_url":"https://api.github.com/users/galgeek/following{/other_user}","gists_url":"https://api.github.com/users/galgeek/gists{/gist_id}","starred_url":"https://api.github.com/users/galgeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galgeek/subscriptions","organizations_url":"https://api.github.com/users/galgeek/orgs","repos_url":"https://api.github.com/users/galgeek/repos","events_url":"https://api.github.com/users/galgeek/events{/privacy}","received_events_url":"https://api.github.com/users/galgeek/received_events","type":"User","site_admin":false},"body":"Hi @whimboo!\r\n\r\nThis PR renames and removes old stats variables and enables opt out from nick-identified data collection. Opt out totals are added to stats. This PR addresses issues #44 and #23 (privacy issues).\r\n\r\nIt also includes a couple of fixes for rebase errors.","created_at":"2015-01-13T04:29:05Z","updated_at":"2015-01-13T17:59:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"27867786863eb1b9d716c86a19afba8e6ca837ea","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/testdaybot/pulls/46/commits","review_comments_url":"https://api.github.com/repos/mozilla/testdaybot/pulls/46/comments","review_comment_url":"https://api.github.com/repos/mozilla/testdaybot/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla/testdaybot/issues/46/comments","statuses_url":"https://api.github.com/repos/mozilla/testdaybot/statuses/6cbb6dc1b9ebdcc33feb6edaa05f7a9c043dd0d0","head":{"label":"galgeek:opt-out","ref":"opt-out","sha":"6cbb6dc1b9ebdcc33feb6edaa05f7a9c043dd0d0","user":{"login":"galgeek","id":3253863,"avatar_url":"https://avatars.githubusercontent.com/u/3253863?v=3","gravatar_id":"","url":"https://api.github.com/users/galgeek","html_url":"https://github.com/galgeek","followers_url":"https://api.github.com/users/galgeek/followers","following_url":"https://api.github.com/users/galgeek/following{/other_user}","gists_url":"https://api.github.com/users/galgeek/gists{/gist_id}","starred_url":"https://api.github.com/users/galgeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galgeek/subscriptions","organizations_url":"https://api.github.com/users/galgeek/orgs","repos_url":"https://api.github.com/users/galgeek/repos","events_url":"https://api.github.com/users/galgeek/events{/privacy}","received_events_url":"https://api.github.com/users/galgeek/received_events","type":"User","site_admin":false},"repo":{"id":27523602,"name":"testdaybot","full_name":"galgeek/testdaybot","owner":{"login":"galgeek","id":3253863,"avatar_url":"https://avatars.githubusercontent.com/u/3253863?v=3","gravatar_id":"","url":"https://api.github.com/users/galgeek","html_url":"https://github.com/galgeek","followers_url":"https://api.github.com/users/galgeek/followers","following_url":"https://api.github.com/users/galgeek/following{/other_user}","gists_url":"https://api.github.com/users/galgeek/gists{/gist_id}","starred_url":"https://api.github.com/users/galgeek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galgeek/subscriptions","organizations_url":"https://api.github.com/users/galgeek/orgs","repos_url":"https://api.github.com/users/galgeek/repos","events_url":"https://api.github.com/users/galgeek/events{/privacy}","received_events_url":"https://api.github.com/users/galgeek/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/galgeek/testdaybot","description":"Mozilla QA Test Day IRC Bot","fork":true,"url":"https://api.github.com/repos/galgeek/testdaybot","forks_url":"https://api.github.com/repos/galgeek/testdaybot/forks","keys_url":"https://api.github.com/repos/galgeek/testdaybot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/galgeek/testdaybot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/galgeek/testdaybot/teams","hooks_url":"https://api.github.com/repos/galgeek/testdaybot/hooks","issue_events_url":"https://api.github.com/repos/galgeek/testdaybot/issues/events{/number}","events_url":"https://api.github.com/repos/galgeek/testdaybot/events","assignees_url":"https://api.github.com/repos/galgeek/testdaybot/assignees{/user}","branches_url":"https://api.github.com/repos/galgeek/testdaybot/branches{/branch}","tags_url":"https://api.github.com/repos/galgeek/testdaybot/tags","blobs_url":"https://api.github.com/repos/galgeek/testdaybot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/galgeek/testdaybot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/galgeek/testdaybot/git/refs{/sha}","trees_url":"https://api.github.com/repos/galgeek/testdaybot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/galgeek/testdaybot/statuses/{sha}","languages_url":"https://api.github.com/repos/galgeek/testdaybot/languages","stargazers_url":"https://api.github.com/repos/galgeek/testdaybot/stargazers","contributors_url":"https://api.github.com/repos/galgeek/testdaybot/contributors","subscribers_url":"https://api.github.com/repos/galgeek/testdaybot/subscribers","subscription_url":"https://api.github.com/repos/galgeek/testdaybot/subscription","commits_url":"https://api.github.com/repos/galgeek/testdaybot/commits{/sha}","git_commits_url":"https://api.github.com/repos/galgeek/testdaybot/git/commits{/sha}","comments_url":"https://api.github.com/repos/galgeek/testdaybot/comments{/number}","issue_comment_url":"https://api.github.com/repos/galgeek/testdaybot/issues/comments/{number}","contents_url":"https://api.github.com/repos/galgeek/testdaybot/contents/{+path}","compare_url":"https://api.github.com/repos/galgeek/testdaybot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/galgeek/testdaybot/merges","archive_url":"https://api.github.com/repos/galgeek/testdaybot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/galgeek/testdaybot/downloads","issues_url":"https://api.github.com/repos/galgeek/testdaybot/issues{/number}","pulls_url":"https://api.github.com/repos/galgeek/testdaybot/pulls{/number}","milestones_url":"https://api.github.com/repos/galgeek/testdaybot/milestones{/number}","notifications_url":"https://api.github.com/repos/galgeek/testdaybot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/galgeek/testdaybot/labels{/name}","releases_url":"https://api.github.com/repos/galgeek/testdaybot/releases{/id}","created_at":"2014-12-04T04:50:14Z","updated_at":"2015-01-12T19:24:06Z","pushed_at":"2015-01-13T04:27:47Z","git_url":"git://github.com/galgeek/testdaybot.git","ssh_url":"git@github.com:galgeek/testdaybot.git","clone_url":"https://github.com/galgeek/testdaybot.git","svn_url":"https://github.com/galgeek/testdaybot","homepage":"http://oss.automatedtester.co.uk/testdaybot/","size":777,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"e38ec3ae5b32984fe4bf26e90637cdf6cb40f077","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":2897698,"name":"testdaybot","full_name":"mozilla/testdaybot","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/testdaybot","description":"Mozilla QA Test Day IRC Bot","fork":false,"url":"https://api.github.com/repos/mozilla/testdaybot","forks_url":"https://api.github.com/repos/mozilla/testdaybot/forks","keys_url":"https://api.github.com/repos/mozilla/testdaybot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/testdaybot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/testdaybot/teams","hooks_url":"https://api.github.com/repos/mozilla/testdaybot/hooks","issue_events_url":"https://api.github.com/repos/mozilla/testdaybot/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/testdaybot/events","assignees_url":"https://api.github.com/repos/mozilla/testdaybot/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/testdaybot/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/testdaybot/tags","blobs_url":"https://api.github.com/repos/mozilla/testdaybot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/testdaybot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/testdaybot/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/testdaybot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/testdaybot/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/testdaybot/languages","stargazers_url":"https://api.github.com/repos/mozilla/testdaybot/stargazers","contributors_url":"https://api.github.com/repos/mozilla/testdaybot/contributors","subscribers_url":"https://api.github.com/repos/mozilla/testdaybot/subscribers","subscription_url":"https://api.github.com/repos/mozilla/testdaybot/subscription","commits_url":"https://api.github.com/repos/mozilla/testdaybot/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/testdaybot/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/testdaybot/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/testdaybot/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla/testdaybot/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/testdaybot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/testdaybot/merges","archive_url":"https://api.github.com/repos/mozilla/testdaybot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/testdaybot/downloads","issues_url":"https://api.github.com/repos/mozilla/testdaybot/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/testdaybot/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/testdaybot/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/testdaybot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/testdaybot/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/testdaybot/releases{/id}","created_at":"2011-12-02T10:15:56Z","updated_at":"2015-01-13T17:38:28Z","pushed_at":"2015-01-13T17:38:28Z","git_url":"git://github.com/mozilla/testdaybot.git","ssh_url":"git@github.com:mozilla/testdaybot.git","clone_url":"https://github.com/mozilla/testdaybot.git","svn_url":"https://github.com/mozilla/testdaybot","homepage":"http://oss.automatedtester.co.uk/testdaybot/","size":642,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":9,"forks":5,"open_issues":9,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/testdaybot/pulls/46"},"html":{"href":"https://github.com/mozilla/testdaybot/pull/46"},"issue":{"href":"https://api.github.com/repos/mozilla/testdaybot/issues/46"},"comments":{"href":"https://api.github.com/repos/mozilla/testdaybot/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/testdaybot/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/testdaybot/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla/testdaybot/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/testdaybot/statuses/6cbb6dc1b9ebdcc33feb6edaa05f7a9c043dd0d0"}}}}