{"action":"created","comment":{"url":"https://api.github.com/repos/discourse/discourse/pulls/comments/200275220","pull_request_review_id":134556908,"id":200275220,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDI3NTIyMA==","diff_hunk":"@@ -482,4 +482,128 @@ def self.report_trending_search(report)\n       }\n     end\n   end\n+\n+  def self.report_moderator_activity(report)\n+    report.data = []\n+    mod_data = {}\n+    mod_ids = []\n+\n+    User.real.where(moderator: true).select(:id, :username).as_json.each do |mod|\n+      mod_data[mod['id']] = {user_id: mod['id'], username: mod['username']}\n+      mod_ids << mod['id']\n+    end\n+\n+    return if mod_ids.empty?\n+\n+    time_read_query = <<~SQL\n+    SELECT SUM(uv.time_read) AS time_read,\n+    uv.user_id\n+    FROM user_visits uv","path":"app/models/report.rb","position":20,"original_position":20,"commit_id":"d2bc0c8a1b3b32cc3c20f6326ad8b64391e58a02","original_commit_id":"d2bc0c8a1b3b32cc3c20f6326ad8b64391e58a02","user":{"login":"ZogStriP","id":362783,"node_id":"MDQ6VXNlcjM2Mjc4Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/362783?v=4","gravatar_id":"","url":"https://api.github.com/users/ZogStriP","html_url":"https://github.com/ZogStriP","followers_url":"https://api.github.com/users/ZogStriP/followers","following_url":"https://api.github.com/users/ZogStriP/following{/other_user}","gists_url":"https://api.github.com/users/ZogStriP/gists{/gist_id}","starred_url":"https://api.github.com/users/ZogStriP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ZogStriP/subscriptions","organizations_url":"https://api.github.com/users/ZogStriP/orgs","repos_url":"https://api.github.com/users/ZogStriP/repos","events_url":"https://api.github.com/users/ZogStriP/events{/privacy}","received_events_url":"https://api.github.com/users/ZogStriP/received_events","type":"User","site_admin":false},"body":"There's no need to use an alias when you're selecting from only 1 table.","created_at":"2018-07-05T08:46:09Z","updated_at":"2018-07-05T08:46:09Z","html_url":"https://github.com/discourse/discourse/pull/6054#discussion_r200275220","pull_request_url":"https://api.github.com/repos/discourse/discourse/pulls/6054","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/discourse/discourse/pulls/comments/200275220"},"html":{"href":"https://github.com/discourse/discourse/pull/6054#discussion_r200275220"},"pull_request":{"href":"https://api.github.com/repos/discourse/discourse/pulls/6054"}}},"pull_request":{"url":"https://api.github.com/repos/discourse/discourse/pulls/6054","id":198202953,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk4MjAyOTUz","html_url":"https://github.com/discourse/discourse/pull/6054","diff_url":"https://github.com/discourse/discourse/pull/6054.diff","patch_url":"https://github.com/discourse/discourse/pull/6054.patch","issue_url":"https://api.github.com/repos/discourse/discourse/issues/6054","number":6054,"state":"open","locked":false,"title":"WIP: Moderator activity reports","user":{"login":"scossar","id":2975917,"node_id":"MDQ6VXNlcjI5NzU5MTc=","avatar_url":"https://avatars3.githubusercontent.com/u/2975917?v=4","gravatar_id":"","url":"https://api.github.com/users/scossar","html_url":"https://github.com/scossar","followers_url":"https://api.github.com/users/scossar/followers","following_url":"https://api.github.com/users/scossar/following{/other_user}","gists_url":"https://api.github.com/users/scossar/gists{/gist_id}","starred_url":"https://api.github.com/users/scossar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scossar/subscriptions","organizations_url":"https://api.github.com/users/scossar/orgs","repos_url":"https://api.github.com/users/scossar/repos","events_url":"https://api.github.com/users/scossar/events{/privacy}","received_events_url":"https://api.github.com/users/scossar/received_events","type":"User","site_admin":false},"body":"This adds reports for moderator activity, recent flags, and staff notes.","created_at":"2018-06-29T02:58:35Z","updated_at":"2018-07-05T08:46:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb0c847d346a9892092a438fa8fa23db67839d77","assignee":null,"assignees":[],"requested_reviewers":[{"login":"jjaffeux","id":339945,"node_id":"MDQ6VXNlcjMzOTk0NQ==","avatar_url":"https://avatars3.githubusercontent.com/u/339945?v=4","gravatar_id":"","url":"https://api.github.com/users/jjaffeux","html_url":"https://github.com/jjaffeux","followers_url":"https://api.github.com/users/jjaffeux/followers","following_url":"https://api.github.com/users/jjaffeux/following{/other_user}","gists_url":"https://api.github.com/users/jjaffeux/gists{/gist_id}","starred_url":"https://api.github.com/users/jjaffeux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjaffeux/subscriptions","organizations_url":"https://api.github.com/users/jjaffeux/orgs","repos_url":"https://api.github.com/users/jjaffeux/repos","events_url":"https://api.github.com/users/jjaffeux/events{/privacy}","received_events_url":"https://api.github.com/users/jjaffeux/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/discourse/discourse/pulls/6054/commits","review_comments_url":"https://api.github.com/repos/discourse/discourse/pulls/6054/comments","review_comment_url":"https://api.github.com/repos/discourse/discourse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/discourse/discourse/issues/6054/comments","statuses_url":"https://api.github.com/repos/discourse/discourse/statuses/d2bc0c8a1b3b32cc3c20f6326ad8b64391e58a02","head":{"label":"discourse:moderator-activity-reports","ref":"moderator-activity-reports","sha":"d2bc0c8a1b3b32cc3c20f6326ad8b64391e58a02","user":{"login":"discourse","id":3220138,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMjAxMzg=","avatar_url":"https://avatars2.githubusercontent.com/u/3220138?v=4","gravatar_id":"","url":"https://api.github.com/users/discourse","html_url":"https://github.com/discourse","followers_url":"https://api.github.com/users/discourse/followers","following_url":"https://api.github.com/users/discourse/following{/other_user}","gists_url":"https://api.github.com/users/discourse/gists{/gist_id}","starred_url":"https://api.github.com/users/discourse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discourse/subscriptions","organizations_url":"https://api.github.com/users/discourse/orgs","repos_url":"https://api.github.com/users/discourse/repos","events_url":"https://api.github.com/users/discourse/events{/privacy}","received_events_url":"https://api.github.com/users/discourse/received_events","type":"Organization","site_admin":false},"repo":{"id":7569578,"node_id":"MDEwOlJlcG9zaXRvcnk3NTY5NTc4","name":"discourse","full_name":"discourse/discourse","owner":{"login":"discourse","id":3220138,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMjAxMzg=","avatar_url":"https://avatars2.githubusercontent.com/u/3220138?v=4","gravatar_id":"","url":"https://api.github.com/users/discourse","html_url":"https://github.com/discourse","followers_url":"https://api.github.com/users/discourse/followers","following_url":"https://api.github.com/users/discourse/following{/other_user}","gists_url":"https://api.github.com/users/discourse/gists{/gist_id}","starred_url":"https://api.github.com/users/discourse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discourse/subscriptions","organizations_url":"https://api.github.com/users/discourse/orgs","repos_url":"https://api.github.com/users/discourse/repos","events_url":"https://api.github.com/users/discourse/events{/privacy}","received_events_url":"https://api.github.com/users/discourse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/discourse/discourse","description":"A platform for community discussion. Free, open, simple.","fork":false,"url":"https://api.github.com/repos/discourse/discourse","forks_url":"https://api.github.com/repos/discourse/discourse/forks","keys_url":"https://api.github.com/repos/discourse/discourse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/discourse/discourse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/discourse/discourse/teams","hooks_url":"https://api.github.com/repos/discourse/discourse/hooks","issue_events_url":"https://api.github.com/repos/discourse/discourse/issues/events{/number}","events_url":"https://api.github.com/repos/discourse/discourse/events","assignees_url":"https://api.github.com/repos/discourse/discourse/assignees{/user}","branches_url":"https://api.github.com/repos/discourse/discourse/branches{/branch}","tags_url":"https://api.github.com/repos/discourse/discourse/tags","blobs_url":"https://api.github.com/repos/discourse/discourse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/discourse/discourse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/discourse/discourse/git/refs{/sha}","trees_url":"https://api.github.com/repos/discourse/discourse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/discourse/discourse/statuses/{sha}","languages_url":"https://api.github.com/repos/discourse/discourse/languages","stargazers_url":"https://api.github.com/repos/discourse/discourse/stargazers","contributors_url":"https://api.github.com/repos/discourse/discourse/contributors","subscribers_url":"https://api.github.com/repos/discourse/discourse/subscribers","subscription_url":"https://api.github.com/repos/discourse/discourse/subscription","commits_url":"https://api.github.com/repos/discourse/discourse/commits{/sha}","git_commits_url":"https://api.github.com/repos/discourse/discourse/git/commits{/sha}","comments_url":"https://api.github.com/repos/discourse/discourse/comments{/number}","issue_comment_url":"https://api.github.com/repos/discourse/discourse/issues/comments{/number}","contents_url":"https://api.github.com/repos/discourse/discourse/contents/{+path}","compare_url":"https://api.github.com/repos/discourse/discourse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/discourse/discourse/merges","archive_url":"https://api.github.com/repos/discourse/discourse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/discourse/discourse/downloads","issues_url":"https://api.github.com/repos/discourse/discourse/issues{/number}","pulls_url":"https://api.github.com/repos/discourse/discourse/pulls{/number}","milestones_url":"https://api.github.com/repos/discourse/discourse/milestones{/number}","notifications_url":"https://api.github.com/repos/discourse/discourse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/discourse/discourse/labels{/name}","releases_url":"https://api.github.com/repos/discourse/discourse/releases{/id}","deployments_url":"https://api.github.com/repos/discourse/discourse/deployments","created_at":"2013-01-12T00:25:55Z","updated_at":"2018-07-05T08:18:59Z","pushed_at":"2018-07-05T08:31:41Z","git_url":"git://github.com/discourse/discourse.git","ssh_url":"git@github.com:discourse/discourse.git","clone_url":"https://github.com/discourse/discourse.git","svn_url":"https://github.com/discourse/discourse","homepage":"https://www.discourse.org","size":224368,"stargazers_count":25437,"watchers_count":25437,"language":"Ruby","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6115,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":6115,"open_issues":17,"watchers":25437,"default_branch":"master"}},"base":{"label":"discourse:master","ref":"master","sha":"252e5574cca1e7f0cce8661922c4269d8e085275","user":{"login":"discourse","id":3220138,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMjAxMzg=","avatar_url":"https://avatars2.githubusercontent.com/u/3220138?v=4","gravatar_id":"","url":"https://api.github.com/users/discourse","html_url":"https://github.com/discourse","followers_url":"https://api.github.com/users/discourse/followers","following_url":"https://api.github.com/users/discourse/following{/other_user}","gists_url":"https://api.github.com/users/discourse/gists{/gist_id}","starred_url":"https://api.github.com/users/discourse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discourse/subscriptions","organizations_url":"https://api.github.com/users/discourse/orgs","repos_url":"https://api.github.com/users/discourse/repos","events_url":"https://api.github.com/users/discourse/events{/privacy}","received_events_url":"https://api.github.com/users/discourse/received_events","type":"Organization","site_admin":false},"repo":{"id":7569578,"node_id":"MDEwOlJlcG9zaXRvcnk3NTY5NTc4","name":"discourse","full_name":"discourse/discourse","owner":{"login":"discourse","id":3220138,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMjAxMzg=","avatar_url":"https://avatars2.githubusercontent.com/u/3220138?v=4","gravatar_id":"","url":"https://api.github.com/users/discourse","html_url":"https://github.com/discourse","followers_url":"https://api.github.com/users/discourse/followers","following_url":"https://api.github.com/users/discourse/following{/other_user}","gists_url":"https://api.github.com/users/discourse/gists{/gist_id}","starred_url":"https://api.github.com/users/discourse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discourse/subscriptions","organizations_url":"https://api.github.com/users/discourse/orgs","repos_url":"https://api.github.com/users/discourse/repos","events_url":"https://api.github.com/users/discourse/events{/privacy}","received_events_url":"https://api.github.com/users/discourse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/discourse/discourse","description":"A platform for community discussion. Free, open, simple.","fork":false,"url":"https://api.github.com/repos/discourse/discourse","forks_url":"https://api.github.com/repos/discourse/discourse/forks","keys_url":"https://api.github.com/repos/discourse/discourse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/discourse/discourse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/discourse/discourse/teams","hooks_url":"https://api.github.com/repos/discourse/discourse/hooks","issue_events_url":"https://api.github.com/repos/discourse/discourse/issues/events{/number}","events_url":"https://api.github.com/repos/discourse/discourse/events","assignees_url":"https://api.github.com/repos/discourse/discourse/assignees{/user}","branches_url":"https://api.github.com/repos/discourse/discourse/branches{/branch}","tags_url":"https://api.github.com/repos/discourse/discourse/tags","blobs_url":"https://api.github.com/repos/discourse/discourse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/discourse/discourse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/discourse/discourse/git/refs{/sha}","trees_url":"https://api.github.com/repos/discourse/discourse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/discourse/discourse/statuses/{sha}","languages_url":"https://api.github.com/repos/discourse/discourse/languages","stargazers_url":"https://api.github.com/repos/discourse/discourse/stargazers","contributors_url":"https://api.github.com/repos/discourse/discourse/contributors","subscribers_url":"https://api.github.com/repos/discourse/discourse/subscribers","subscription_url":"https://api.github.com/repos/discourse/discourse/subscription","commits_url":"https://api.github.com/repos/discourse/discourse/commits{/sha}","git_commits_url":"https://api.github.com/repos/discourse/discourse/git/commits{/sha}","comments_url":"https://api.github.com/repos/discourse/discourse/comments{/number}","issue_comment_url":"https://api.github.com/repos/discourse/discourse/issues/comments{/number}","contents_url":"https://api.github.com/repos/discourse/discourse/contents/{+path}","compare_url":"https://api.github.com/repos/discourse/discourse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/discourse/discourse/merges","archive_url":"https://api.github.com/repos/discourse/discourse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/discourse/discourse/downloads","issues_url":"https://api.github.com/repos/discourse/discourse/issues{/number}","pulls_url":"https://api.github.com/repos/discourse/discourse/pulls{/number}","milestones_url":"https://api.github.com/repos/discourse/discourse/milestones{/number}","notifications_url":"https://api.github.com/repos/discourse/discourse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/discourse/discourse/labels{/name}","releases_url":"https://api.github.com/repos/discourse/discourse/releases{/id}","deployments_url":"https://api.github.com/repos/discourse/discourse/deployments","created_at":"2013-01-12T00:25:55Z","updated_at":"2018-07-05T08:18:59Z","pushed_at":"2018-07-05T08:31:41Z","git_url":"git://github.com/discourse/discourse.git","ssh_url":"git@github.com:discourse/discourse.git","clone_url":"https://github.com/discourse/discourse.git","svn_url":"https://github.com/discourse/discourse","homepage":"https://www.discourse.org","size":224368,"stargazers_count":25437,"watchers_count":25437,"language":"Ruby","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6115,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":6115,"open_issues":17,"watchers":25437,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/discourse/discourse/pulls/6054"},"html":{"href":"https://github.com/discourse/discourse/pull/6054"},"issue":{"href":"https://api.github.com/repos/discourse/discourse/issues/6054"},"comments":{"href":"https://api.github.com/repos/discourse/discourse/issues/6054/comments"},"review_comments":{"href":"https://api.github.com/repos/discourse/discourse/pulls/6054/comments"},"review_comment":{"href":"https://api.github.com/repos/discourse/discourse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/discourse/discourse/pulls/6054/commits"},"statuses":{"href":"https://api.github.com/repos/discourse/discourse/statuses/d2bc0c8a1b3b32cc3c20f6326ad8b64391e58a02"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"ZogStriP"}}