GitHub PullRequestReviewCommentEvent at 2014-08-18 09:17:07
Repository: app
Actor: hakubo
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/Wikia/app/pulls/comments/16343502","id":16343502,"diff_hunk":"@@ -0,0 +1,117 @@\n+<?php\n+\n+class MercuryApiController extends WikiaController {\n+\n+\tconst PARAM_ARTICLE_ID = 'articleId';\n+\tconst PARAM_PAGE = 'page';\n+\tconst NUMBER_CONTRIBUTORS = 6;\n+\tconst DEFAULT_PAGE = 1;\n+\n+\tprivate $mercuryApi = null;\n+\n+\tpublic function __construct() {\n+\t\tparent::__construct();\n+\t\t$this->mercuryApi = new MercuryApi();\n+\t}\n+\n+\t/**\n+\t * @desc Returns number of comments per article\n+\t *\n+\t * @throws NotFoundApiException\n+\t * @throws InvalidParameterApiException\n+\t */\n+\tpublic function getArticleCommentsCount() {\n+\t\t$articleId = $this->request->getInt( self::PARAM_ARTICLE_ID );\n+\n+\t\tif( $articleId === 0 ) {\n+\t\t\tthrow new InvalidParameterApiException( self::PARAM_ARTICLE_ID );\n+\t\t}\n+\n+\t\t$title = Title::newFromID( $articleId );\n+\t\tif ( empty( $title ) ) {\n+\t\t\tthrow new NotFoundApiException( self::PARAM_ARTICLE_ID );\n+\t\t}\n+\n+\t\t$count = 0;\n+\t\tif ( !empty( $this->app->wg->EnableArticleCommentsExt ) ) {\n+\t\t\t// Article comments not enabled\n+\t\t\t$count = $this->mercuryApi->articleCommentsCount( $title );\n+\t\t}\n+\t\t$this->response->setVal( 'count', $count );\n+\t\t$this->response->setFormat( WikiaResponse::FORMAT_JSON );\n+\t}\n+\n+\t/**\n+\t * @desc Returns user ids for top contributors\n+\t *\n+\t * @throws NotFoundApiException\n+\t * @throws InvalidParameterApiException\n+\t */\n+\tpublic function getTopContributorsPerArticle() {\n+\t\t$articleId = $this->request->getInt( self::PARAM_ARTICLE_ID );\n+\n+\t\tif( $articleId === 0 ) {\n+\t\t\tthrow new InvalidParameterApiException( self::PARAM_ARTICLE_ID );\n+\t\t}\n+\n+\t\t$title = Title::newFromID( $articleId );\n+\t\tif ( empty( $title ) ) {\n+\t\t\tthrow new NotFoundApiException( self::PARAM_ARTICLE_ID );\n+\t\t}\n+\n+\t\t$usersIds = $this->mercuryApi->topContributorsPerArticle( $title, self::NUMBER_CONTRIBUTORS );\n+\n+\t\t$this->response->setVal( 'items', $usersIds );\n+\t\t$this->response->setFormat( WikiaResponse::FORMAT_JSON );\n+\t}\n+\n+\t/**\n+\t * @desc Returns theme settings for the current wiki\n+\t */\n+\tpublic function getWikiSettings() {\n+\t\t$theme = $this->mercuryApi->getWikiSettings();\n+\t\t$this->response->setVal( 'settings', $theme );\n+\t\t$this->response->setFormat( WikiaResponse::FORMAT_JSON );\n+\t}\n+\n+\t/**\n+\t * @desc Returns article comments in JSON format\n+\t *\n+\t * @throws NotFoundApiException\n+\t * @throws BadRequestApiException\n+\t * @throws InvalidParameterApiException\n+\t */\n+\tpublic function getArticleComments() {\n+\t\t$articleId = $this->request->getInt( self::PARAM_ARTICLE_ID, 0 );\n+\n+\t\tif( $articleId === 0 ) {\n+\t\t\tthrow new InvalidParameterApiException( self::PARAM_ARTICLE_ID );\n+\t\t}\n+\n+\t\t$title = Title::newFromID( $articleId );\n+\t\tif ( !( $title instanceof Title ) ) {\n+\t\t\tthrow new NotFoundApiException( self::PARAM_ARTICLE_ID );\n+\t\t}\n+\n+\t\t$page = $this->request->getInt( self::PARAM_PAGE, self::DEFAULT_PAGE );\n+\n+\t\t$commentsResponse = $this->app->sendRequest( 'ArticleComments', 'WikiaMobileCommentsPage', [\n+\t\t\t'articleID' => $articleId,\n+\t\t\t'page' => $page,\n+\t\t\t'format' => WikiaResponse::FORMAT_JSON\n+\t\t] );","path":"extensions/wikia/MercuryApi/MercuryApiController.class.php","position":105,"original_position":102,"commit_id":"5262262ff3dafaebac9a465f822f0a89d2b0823d","original_commit_id":"d046d3382e5e2c2a8622f955a3c89e5113773e51","user":{"login":"hakubo","id":1018759,"avatar_url":"https://avatars.githubusercontent.com/u/1018759?v=2","gravatar_id":"436a51c106f26ddb5e5379479842c8c0","url":"https://api.github.com/users/hakubo","html_url":"https://github.com/hakubo","followers_url":"https://api.github.com/users/hakubo/followers","following_url":"https://api.github.com/users/hakubo/following{/other_user}","gists_url":"https://api.github.com/users/hakubo/gists{/gist_id}","starred_url":"https://api.github.com/users/hakubo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hakubo/subscriptions","organizations_url":"https://api.github.com/users/hakubo/orgs","repos_url":"https://api.github.com/users/hakubo/repos","events_url":"https://api.github.com/users/hakubo/events{/privacy}","received_events_url":"https://api.github.com/users/hakubo/received_events","type":"User","site_admin":false},"body":"agree, speed of development for us was the key\r\nwe will revisit practices like this when we are sure that this is the path we want to go","created_at":"2014-08-18T09:17:07Z","updated_at":"2014-08-18T09:17:07Z","html_url":"https://github.com/Wikia/app/pull/3649#discussion_r16343502","pull_request_url":"https://api.github.com/repos/Wikia/app/pulls/3649","_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments/16343502"},"html":{"href":"https://github.com/Wikia/app/pull/3649#discussion_r16343502"},"pull_request":{"href":"https://api.github.com/repos/Wikia/app/pulls/3649"}}},"pull_request":{"url":"https://api.github.com/repos/Wikia/app/pulls/3649","id":16192495,"html_url":"https://github.com/Wikia/app/pull/3649","diff_url":"https://github.com/Wikia/app/pull/3649.diff","patch_url":"https://github.com/Wikia/app/pull/3649.patch","issue_url":"https://api.github.com/repos/Wikia/app/issues/3649","number":3649,"state":"open","locked":false,"title":"HG-16: Mercury API Extension","user":{"login":"aquilax","id":328067,"avatar_url":"https://avatars.githubusercontent.com/u/328067?v=2","gravatar_id":"8cf592a20de754300721bf954aa40507","url":"https://api.github.com/users/aquilax","html_url":"https://github.com/aquilax","followers_url":"https://api.github.com/users/aquilax/followers","following_url":"https://api.github.com/users/aquilax/following{/other_user}","gists_url":"https://api.github.com/users/aquilax/gists{/gist_id}","starred_url":"https://api.github.com/users/aquilax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aquilax/subscriptions","organizations_url":"https://api.github.com/users/aquilax/orgs","repos_url":"https://api.github.com/users/aquilax/repos","events_url":"https://api.github.com/users/aquilax/events{/privacy}","received_events_url":"https://api.github.com/users/aquilax/received_events","type":"User","site_admin":false},"body":"DO NOT MERGE, THIS PR IS PART OF PROJECT MERCURY! ","created_at":"2014-05-21T22:32:29Z","updated_at":"2014-08-18T09:17:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c2daf4a43c0ede3d97edd1e2b1908a11ef97bb7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Wikia/app/pulls/3649/commits","review_comments_url":"https://api.github.com/repos/Wikia/app/pulls/3649/comments","review_comment_url":"https://api.github.com/repos/Wikia/app/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Wikia/app/issues/3649/comments","statuses_url":"https://api.github.com/repos/Wikia/app/statuses/5262262ff3dafaebac9a465f822f0a89d2b0823d","head":{"label":"Wikia:mercury","ref":"mercury","sha":"5262262ff3dafaebac9a465f822f0a89d2b0823d","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=2","gravatar_id":"7d465709e42f40da92f14aae7e005558","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=2","gravatar_id":"7d465709e42f40da92f14aae7e005558","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}","created_at":"2012-08-23T20:55:58Z","updated_at":"2014-07-19T07:47:56Z","pushed_at":"2014-08-18T08:05:11Z","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":737394,"stargazers_count":60,"watchers_count":60,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":41,"mirror_url":null,"open_issues_count":55,"forks":41,"open_issues":55,"watchers":60,"default_branch":"dev"}},"base":{"label":"Wikia:dev","ref":"dev","sha":"c9d88c9ecd0881aa86b1f9177c5ec2796b81bf80","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=2","gravatar_id":"7d465709e42f40da92f14aae7e005558","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=2","gravatar_id":"7d465709e42f40da92f14aae7e005558","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}","created_at":"2012-08-23T20:55:58Z","updated_at":"2014-07-19T07:47:56Z","pushed_at":"2014-08-18T08:05:11Z","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":737394,"stargazers_count":60,"watchers_count":60,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":41,"mirror_url":null,"open_issues_count":55,"forks":41,"open_issues":55,"watchers":60,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Wikia/app/pulls/3649"},"html":{"href":"https://github.com/Wikia/app/pull/3649"},"issue":{"href":"https://api.github.com/repos/Wikia/app/issues/3649"},"comments":{"href":"https://api.github.com/repos/Wikia/app/issues/3649/comments"},"review_comments":{"href":"https://api.github.com/repos/Wikia/app/pulls/3649/comments"},"review_comment":{"href":"https://api.github.com/repos/Wikia/app/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Wikia/app/pulls/3649/commits"},"statuses":{"href":"https://api.github.com/repos/Wikia/app/statuses/5262262ff3dafaebac9a465f822f0a89d2b0823d"}}}}