{"action":"created","comment":{"url":"https://api.github.com/repos/Wikia/app/pulls/comments/62987789","id":62987789,"diff_hunk":"@@ -242,52 +246,98 @@ function () use ( $limit ) {\n \t\treturn $data;\n \t}\n \n+\tprivate function getAllContributorsWithCurrentUser( $allContributorsData, $currentUserId ) {\n+\t\tglobal $wgCityId;\n+\n+\t\t// Get current user's stats\n+\t\t$checkUserCallback = function( $user ) { return true; };\n+\t\t$userInfo = $this->wikiService->getUserInfo(\n+\t\t\t$currentUserId,\n+\t\t\t$wgCityId,\n+\t\t\tAvatarService::AVATAR_SIZE_SMALL_PLUS,\n+\t\t\t$checkUserCallback\n+\t\t);\n+\n+\t\tif ($userInfo['lastRevision'] !== null) {\n+\t\t\t// Remove from all users list if present\n+\t\t\t// Done manually to make sure current user data is never out of sync due to cache\n+\t\t\tforeach ($allContributorsData as $key => $item) {\n+\t\t\t\tif ( $item['userId'] === $currentUserId) {\n+\t\t\t\t\tunset( $allContributorsData[$key] );\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\t}\n+\n+\t\t\t// Add current user on top of list\n+\t\t\t$avatar = AvatarService::renderAvatar( $userInfo['name'], AvatarService::AVATAR_SIZE_SMALL_PLUS );\n+\n+\t\t\t$data = [\n+\t\t\t\t'userId' => $currentUserId,\n+\t\t\t\t'latestRevision' => $userInfo['lastRevision'],\n+\t\t\t\t'timeAgo' => wfTimeFormatAgo( $userInfo['lastRevision'] ),\n+\t\t\t\t'userName' => $userInfo['name'],\n+\t\t\t\t'isAdmin' => $this->isAdmin( $currentUserId, $this->getAdmins() ),\n+\t\t\t\t'isCurrent' => true,\n+\t\t\t\t'avatar' => $avatar,\n+\t\t\t\t'profilePage' => $userInfo['userPageUrl'],\n+\t\t\t];\n+\n+\t\t\tarray_unshift( $allContributorsData, $data );\n+\t\t}\n+\n+\t\treturn $allContributorsData;\n+\t}\n+\n \t/**\n \t * Gets a list of all members of the community.\n \t * Any user who has made an edit in the last 2 years is a member\n \t *\n-\t * @return array\n+\t * @param null $currentUserId\n+\t * @return Mixed|null\n \t */\n-\tpublic function getAllMembers() {\n-\t\t$data = WikiaDataAccess::cache(\n+\tpublic function getAllContributors( $currentUserId = null ) {\n+\t\t$allContributorsData = WikiaDataAccess::cache(\n \t\t\twfMemcKey( self::ALL_MEMBERS_MCACHE_KEY ),\n-\t\t\tWikiaResponse::CACHE_STANDARD,\n-\t\t\tfunction () {\n+\t\t\tWikiaResponse::CACHE_SHORT,\n+\t\t\tfunction () use ( $currentUserId ) {\n \t\t\t\t$db = wfGetDB( DB_SLAVE );\n \n-\t\t\t\t$sqlData = ( new WikiaSQL() )\n-\t\t\t\t\t->SELECT( '*' )\n-\t\t\t\t\t->FROM ( 'wikia_user_properties' )\n-\t\t\t\t\t->LEFT_JOIN( 'user_groups' )->ON( 'wup_user = ug_user' )\n-\t\t\t\t\t->WHERE ( 'wup_property' )->EQUAL_TO( 'firstContributionTimestamp' )\n-\t\t\t\t\t->AND_ ( 'wup_value > DATE_SUB(now(), INTERVAL 2 YEAR)' )\n-\t\t\t\t\t->ORDER_BY( 'wup_value DESC' )\n-\t\t\t\t\t->runLoop( $db, function ( &$sqlData, $row ) {\n-\t\t\t\t\t\t$user = User::newFromId( $row->wup_user );\n-\t\t\t\t\t\t$userName = $user->getName();\n+\t\t\t\t$userSqlData = ( new WikiaSQL() )\n+\t\t\t\t\t->SELECT( 'rev_user, rev_timestamp' )\n+\t\t\t\t\t->FROM( 'revision' )\n+\t\t\t\t\t->WHERE( 'rev_timestamp > DATE_SUB(now(), INTERVAL 2 YEAR)' )\n+\t\t\t\t\t->AND_( 'rev_user' )->NOT_EQUAL_TO( 0 )\n+\t\t\t\t\t->GROUP_BY( 'rev_user' )\n+\t\t\t\t\t->ORDER_BY( 'rev_timestamp DESC' )\n+\t\t\t\t\t->LIMIT( self::ALL_CONTRIBUTORS_MODAL_LIMIT )\n+\t\t\t\t\t->runLoop( $db, function ( &$userSqlData, $row ) use ( $currentUserId ) {","path":"extensions/wikia/CommunityPage/models/CommunityPageSpecialUsersModel.class.php","position":104,"original_position":104,"commit_id":"235568b8f0629d58d170565c2b05ff47f70f759e","original_commit_id":"235568b8f0629d58d170565c2b05ff47f70f759e","user":{"login":"Grunny","id":230630,"avatar_url":"https://avatars.githubusercontent.com/u/230630?v=3","gravatar_id":"","url":"https://api.github.com/users/Grunny","html_url":"https://github.com/Grunny","followers_url":"https://api.github.com/users/Grunny/followers","following_url":"https://api.github.com/users/Grunny/following{/other_user}","gists_url":"https://api.github.com/users/Grunny/gists{/gist_id}","starred_url":"https://api.github.com/users/Grunny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Grunny/subscriptions","organizations_url":"https://api.github.com/users/Grunny/orgs","repos_url":"https://api.github.com/users/Grunny/repos","events_url":"https://api.github.com/users/Grunny/events{/privacy}","received_events_url":"https://api.github.com/users/Grunny/received_events","type":"User","site_admin":false},"body":"`$currentUserId` isn't used in this method.","created_at":"2016-05-12T09:12:33Z","updated_at":"2016-05-12T09:12:33Z","html_url":"https://github.com/Wikia/app/pull/10452#discussion_r62987789","pull_request_url":"https://api.github.com/repos/Wikia/app/pulls/10452","_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments/62987789"},"html":{"href":"https://github.com/Wikia/app/pull/10452#discussion_r62987789"},"pull_request":{"href":"https://api.github.com/repos/Wikia/app/pulls/10452"}}},"pull_request":{"url":"https://api.github.com/repos/Wikia/app/pulls/10452","id":69679695,"html_url":"https://github.com/Wikia/app/pull/10452","diff_url":"https://github.com/Wikia/app/pull/10452.diff","patch_url":"https://github.com/Wikia/app/pull/10452.patch","issue_url":"https://api.github.com/repos/Wikia/app/issues/10452","number":10452,"state":"open","locked":false,"title":"JPN-415 All contributors list refactoring","user":{"login":"adamkarminski","id":5011775,"avatar_url":"https://avatars.githubusercontent.com/u/5011775?v=3","gravatar_id":"","url":"https://api.github.com/users/adamkarminski","html_url":"https://github.com/adamkarminski","followers_url":"https://api.github.com/users/adamkarminski/followers","following_url":"https://api.github.com/users/adamkarminski/following{/other_user}","gists_url":"https://api.github.com/users/adamkarminski/gists{/gist_id}","starred_url":"https://api.github.com/users/adamkarminski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamkarminski/subscriptions","organizations_url":"https://api.github.com/users/adamkarminski/orgs","repos_url":"https://api.github.com/users/adamkarminski/repos","events_url":"https://api.github.com/users/adamkarminski/events{/privacy}","received_events_url":"https://api.github.com/users/adamkarminski/received_events","type":"User","site_admin":false},"body":"@perjg ","created_at":"2016-05-11T14:16:02Z","updated_at":"2016-05-12T09:12:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1cbfbd03d2e51878281092ea9cf58d6d46499a4b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Wikia/app/pulls/10452/commits","review_comments_url":"https://api.github.com/repos/Wikia/app/pulls/10452/comments","review_comment_url":"https://api.github.com/repos/Wikia/app/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Wikia/app/issues/10452/comments","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/235568b8f0629d58d170565c2b05ff47f70f759e","head":{"label":"Wikia:JPN-415-all-contributors-refactor","ref":"JPN-415-all-contributors-refactor","sha":"235568b8f0629d58d170565c2b05ff47f70f759e","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":5532313,"name":"app","full_name":"Wikia/app","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/app","description":"Wikia Application Code","fork":false,"url":"https://api.github.com/repos/Wikia/app","forks_url":"https://api.github.com/repos/Wikia/app/forks","keys_url":"https://api.github.com/repos/Wikia/app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/app/teams","hooks_url":"https://api.github.com/repos/Wikia/app/hooks","issue_events_url":"https://api.github.com/repos/Wikia/app/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/app/events","assignees_url":"https://api.github.com/repos/Wikia/app/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/app/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/app/tags","blobs_url":"https://api.github.com/repos/Wikia/app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/app/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/app/languages","stargazers_url":"https://api.github.com/repos/Wikia/app/stargazers","contributors_url":"https://api.github.com/repos/Wikia/app/contributors","subscribers_url":"https://api.github.com/repos/Wikia/app/subscribers","subscription_url":"https://api.github.com/repos/Wikia/app/subscription","commits_url":"https://api.github.com/repos/Wikia/app/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/app/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/app/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/app/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/app/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/app/merges","archive_url":"https://api.github.com/repos/Wikia/app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/app/downloads","issues_url":"https://api.github.com/repos/Wikia/app/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/app/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/app/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/app/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/app/releases{/id}","deployments_url":"https://api.github.com/repos/Wikia/app/deployments","created_at":"2012-08-23T20:55:58Z","updated_at":"2016-05-11T23:13:41Z","pushed_at":"2016-05-12T08:50:28Z","git_url":"git://github.com/Wikia/app.git","ssh_url":"git@github.com:Wikia/app.git","clone_url":"https://github.com/Wikia/app.git","svn_url":"https://github.com/Wikia/app","homepage":"http://dev.wikia.com","size":2311471,"stargazers_count":96,"watchers_count":96,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":78,"mirror_url":null,"open_issues_count":92,"forks":78,"open_issues":92,"watchers":96,"default_branch":"dev"}},"base":{"label":"Wikia:dev","ref":"dev","sha":"676e6bc1359ddd63bd7b49ca2a143314ed5353ff","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":5532313,"name":"app","full_name":"Wikia/app","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/app","description":"Wikia Application Code","fork":false,"url":"https://api.github.com/repos/Wikia/app","forks_url":"https://api.github.com/repos/Wikia/app/forks","keys_url":"https://api.github.com/repos/Wikia/app/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/app/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/app/teams","hooks_url":"https://api.github.com/repos/Wikia/app/hooks","issue_events_url":"https://api.github.com/repos/Wikia/app/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/app/events","assignees_url":"https://api.github.com/repos/Wikia/app/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/app/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/app/tags","blobs_url":"https://api.github.com/repos/Wikia/app/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/app/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/app/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/app/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/app/languages","stargazers_url":"https://api.github.com/repos/Wikia/app/stargazers","contributors_url":"https://api.github.com/repos/Wikia/app/contributors","subscribers_url":"https://api.github.com/repos/Wikia/app/subscribers","subscription_url":"https://api.github.com/repos/Wikia/app/subscription","commits_url":"https://api.github.com/repos/Wikia/app/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/app/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/app/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/app/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/app/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/app/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/app/merges","archive_url":"https://api.github.com/repos/Wikia/app/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/app/downloads","issues_url":"https://api.github.com/repos/Wikia/app/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/app/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/app/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/app/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/app/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/app/releases{/id}","deployments_url":"https://api.github.com/repos/Wikia/app/deployments","created_at":"2012-08-23T20:55:58Z","updated_at":"2016-05-11T23:13:41Z","pushed_at":"2016-05-12T08:50:28Z","git_url":"git://github.com/Wikia/app.git","ssh_url":"git@github.com:Wikia/app.git","clone_url":"https://github.com/Wikia/app.git","svn_url":"https://github.com/Wikia/app","homepage":"http://dev.wikia.com","size":2311471,"stargazers_count":96,"watchers_count":96,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":78,"mirror_url":null,"open_issues_count":92,"forks":78,"open_issues":92,"watchers":96,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/10452"},"html":{"href":"https://github.com/Wikia/app/pull/10452"},"issue":{"href":"https://api.github.com/repos/Wikia/app/issues/10452"},"comments":{"href":"https://api.github.com/repos/Wikia/app/issues/10452/comments"},"review_comments":{"href":"https://api.github.com/repos/Wikia/app/pulls/10452/comments"},"review_comment":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Wikia/app/pulls/10452/commits"},"statuses":{"href":"https://api.github.com/repos/Wikia/app/statuses/235568b8f0629d58d170565c2b05ff47f70f759e"}}}}