{"action":"created","comment":{"url":"https://api.github.com/repos/j-asis/Web-Portal/pulls/comments/27940989","id":27940989,"diff_hunk":"@@ -0,0 +1,68 @@\n+<?php\n+\n+class CommentController extends AppController \n+{\n+    public function edit()\n+    {\n+        $user = new User($_SESSION['username']);\n+        $check = Param::get('check', false);\n+        $title = \" | Edit comment\";\n+        $params = array(\n+            'comment_id' => Param::get('id', ''),\n+            'thread_id'  => Param::get('thread_id', ''),\n+            'user_id'    => $user->user_id,\n+        );\n+        $comment = new Comment($params);\n+\n+        $comment_content = Comment::getCommentContent(Param::get('id', 0));\n+        $comment->error = isset($comment_content->error) ? $comment_content->error : null;\n+        if (isset($comment->error)) {\n+            $this->set(get_defined_vars());\n+            return;\n+        }\n+        if ($comment_content->user_id !== $user->user_id) {\n+            $comment->error = 'Cannot edit other user\\'s comment';\n+            $this->set(get_defined_vars());\n+            return;\n+        }\n+        if ($check) {\n+            $comment->body = Param::get('new_comment', '');\n+            try {\n+                $comment->edit();\n+            } catch (ValidationException $e) {\n+                $comment->error = 'Input Error, Please enter at from 1 to 200 charcters';\n+            } catch (Exception $e) {\n+                $comment->error = 'Unexpected Error occured';\n+            }\n+        }\n+        $this->set(get_defined_vars());\n+    }\n+\n+    public function like()\n+    {\n+        $user = new User($_SESSION['username']);\n+        $params = array(\n+            'comment_id' => Param::get('comment_id', 0),\n+            'type'       => Param::get('type', 'like'),\n+            'back'       => Param::get('back', '/'),\n+            'user_id'    => $user->user_id,\n+        );\n+        if ($params['comment_id'] === 0) {\n+            redirect(url('/'));\n+            return;\n+        }\n+        $like = new Like($params);\n+        $like->comment();","path":"app/controllers/comment_controller.php","position":55,"original_position":55,"commit_id":"a42f0738a50a14b01d1e95e3bb03cbc96a96747b","original_commit_id":"a42f0738a50a14b01d1e95e3bb03cbc96a96747b","user":{"login":"jm-factorin","id":2919310,"avatar_url":"https://avatars.githubusercontent.com/u/2919310?v=3","gravatar_id":"","url":"https://api.github.com/users/jm-factorin","html_url":"https://github.com/jm-factorin","followers_url":"https://api.github.com/users/jm-factorin/followers","following_url":"https://api.github.com/users/jm-factorin/following{/other_user}","gists_url":"https://api.github.com/users/jm-factorin/gists{/gist_id}","starred_url":"https://api.github.com/users/jm-factorin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jm-factorin/subscriptions","organizations_url":"https://api.github.com/users/jm-factorin/orgs","repos_url":"https://api.github.com/users/jm-factorin/repos","events_url":"https://api.github.com/users/jm-factorin/events{/privacy}","received_events_url":"https://api.github.com/users/jm-factorin/received_events","type":"User","site_admin":false},"body":"maybe you can refactor this? you can refer to this https://github.com/j-asis/Web-Portal/pull/2/files#r27940874\r\n\r\nthe method call or function names must be informative.\r\nand the other developer(s) must understand its functionality easily by just seeing/reading this statement;\r\nsomething like: Like::doLike($user_id, $comment_id)` and/or `Like::unlike($like_id)`","created_at":"2015-04-08T03:55:28Z","updated_at":"2015-04-08T03:55:28Z","html_url":"https://github.com/j-asis/Web-Portal/pull/2#discussion_r27940989","pull_request_url":"https://api.github.com/repos/j-asis/Web-Portal/pulls/2","_links":{"self":{"href":"https://api.github.com/repos/j-asis/Web-Portal/pulls/comments/27940989"},"html":{"href":"https://github.com/j-asis/Web-Portal/pull/2#discussion_r27940989"},"pull_request":{"href":"https://api.github.com/repos/j-asis/Web-Portal/pulls/2"}}},"pull_request":{"url":"https://api.github.com/repos/j-asis/Web-Portal/pulls/2","id":32669270,"html_url":"https://github.com/j-asis/Web-Portal/pull/2","diff_url":"https://github.com/j-asis/Web-Portal/pull/2.diff","patch_url":"https://github.com/j-asis/Web-Portal/pull/2.patch","issue_url":"https://api.github.com/repos/j-asis/Web-Portal/issues/2","number":2,"state":"open","locked":false,"title":"dev_1.1","user":{"login":"j-asis","id":10919932,"avatar_url":"https://avatars.githubusercontent.com/u/10919932?v=3","gravatar_id":"","url":"https://api.github.com/users/j-asis","html_url":"https://github.com/j-asis","followers_url":"https://api.github.com/users/j-asis/followers","following_url":"https://api.github.com/users/j-asis/following{/other_user}","gists_url":"https://api.github.com/users/j-asis/gists{/gist_id}","starred_url":"https://api.github.com/users/j-asis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-asis/subscriptions","organizations_url":"https://api.github.com/users/j-asis/orgs","repos_url":"https://api.github.com/users/j-asis/repos","events_url":"https://api.github.com/users/j-asis/events{/privacy}","received_events_url":"https://api.github.com/users/j-asis/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-06T09:20:01Z","updated_at":"2015-04-08T03:55:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b68a70b873b6d5b13eaa52edd3bdce150e62ae1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/j-asis/Web-Portal/pulls/2/commits","review_comments_url":"https://api.github.com/repos/j-asis/Web-Portal/pulls/2/comments","review_comment_url":"https://api.github.com/repos/j-asis/Web-Portal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/j-asis/Web-Portal/issues/2/comments","statuses_url":"https://api.github.com/repos/j-asis/Web-Portal/statuses/a42f0738a50a14b01d1e95e3bb03cbc96a96747b","head":{"label":"j-asis:dev_1.1","ref":"dev_1.1","sha":"a42f0738a50a14b01d1e95e3bb03cbc96a96747b","user":{"login":"j-asis","id":10919932,"avatar_url":"https://avatars.githubusercontent.com/u/10919932?v=3","gravatar_id":"","url":"https://api.github.com/users/j-asis","html_url":"https://github.com/j-asis","followers_url":"https://api.github.com/users/j-asis/followers","following_url":"https://api.github.com/users/j-asis/following{/other_user}","gists_url":"https://api.github.com/users/j-asis/gists{/gist_id}","starred_url":"https://api.github.com/users/j-asis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-asis/subscriptions","organizations_url":"https://api.github.com/users/j-asis/orgs","repos_url":"https://api.github.com/users/j-asis/repos","events_url":"https://api.github.com/users/j-asis/events{/privacy}","received_events_url":"https://api.github.com/users/j-asis/received_events","type":"User","site_admin":false},"repo":{"id":32000660,"name":"Web-Portal","full_name":"j-asis/Web-Portal","owner":{"login":"j-asis","id":10919932,"avatar_url":"https://avatars.githubusercontent.com/u/10919932?v=3","gravatar_id":"","url":"https://api.github.com/users/j-asis","html_url":"https://github.com/j-asis","followers_url":"https://api.github.com/users/j-asis/followers","following_url":"https://api.github.com/users/j-asis/following{/other_user}","gists_url":"https://api.github.com/users/j-asis/gists{/gist_id}","starred_url":"https://api.github.com/users/j-asis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-asis/subscriptions","organizations_url":"https://api.github.com/users/j-asis/orgs","repos_url":"https://api.github.com/users/j-asis/repos","events_url":"https://api.github.com/users/j-asis/events{/privacy}","received_events_url":"https://api.github.com/users/j-asis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/j-asis/Web-Portal","description":"","fork":false,"url":"https://api.github.com/repos/j-asis/Web-Portal","forks_url":"https://api.github.com/repos/j-asis/Web-Portal/forks","keys_url":"https://api.github.com/repos/j-asis/Web-Portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/j-asis/Web-Portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/j-asis/Web-Portal/teams","hooks_url":"https://api.github.com/repos/j-asis/Web-Portal/hooks","issue_events_url":"https://api.github.com/repos/j-asis/Web-Portal/issues/events{/number}","events_url":"https://api.github.com/repos/j-asis/Web-Portal/events","assignees_url":"https://api.github.com/repos/j-asis/Web-Portal/assignees{/user}","branches_url":"https://api.github.com/repos/j-asis/Web-Portal/branches{/branch}","tags_url":"https://api.github.com/repos/j-asis/Web-Portal/tags","blobs_url":"https://api.github.com/repos/j-asis/Web-Portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/j-asis/Web-Portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/j-asis/Web-Portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/j-asis/Web-Portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/j-asis/Web-Portal/statuses/{sha}","languages_url":"https://api.github.com/repos/j-asis/Web-Portal/languages","stargazers_url":"https://api.github.com/repos/j-asis/Web-Portal/stargazers","contributors_url":"https://api.github.com/repos/j-asis/Web-Portal/contributors","subscribers_url":"https://api.github.com/repos/j-asis/Web-Portal/subscribers","subscription_url":"https://api.github.com/repos/j-asis/Web-Portal/subscription","commits_url":"https://api.github.com/repos/j-asis/Web-Portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/j-asis/Web-Portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/j-asis/Web-Portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/j-asis/Web-Portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/j-asis/Web-Portal/contents/{+path}","compare_url":"https://api.github.com/repos/j-asis/Web-Portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/j-asis/Web-Portal/merges","archive_url":"https://api.github.com/repos/j-asis/Web-Portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/j-asis/Web-Portal/downloads","issues_url":"https://api.github.com/repos/j-asis/Web-Portal/issues{/number}","pulls_url":"https://api.github.com/repos/j-asis/Web-Portal/pulls{/number}","milestones_url":"https://api.github.com/repos/j-asis/Web-Portal/milestones{/number}","notifications_url":"https://api.github.com/repos/j-asis/Web-Portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/j-asis/Web-Portal/labels{/name}","releases_url":"https://api.github.com/repos/j-asis/Web-Portal/releases{/id}","created_at":"2015-03-11T05:47:12Z","updated_at":"2015-04-08T02:40:48Z","pushed_at":"2015-04-08T02:40:48Z","git_url":"git://github.com/j-asis/Web-Portal.git","ssh_url":"git@github.com:j-asis/Web-Portal.git","clone_url":"https://github.com/j-asis/Web-Portal.git","svn_url":"https://github.com/j-asis/Web-Portal","homepage":null,"size":484,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"dev_1.1"}},"base":{"label":"j-asis:master","ref":"master","sha":"20ae20b74116a56361dfd559a07909f8cc4238be","user":{"login":"j-asis","id":10919932,"avatar_url":"https://avatars.githubusercontent.com/u/10919932?v=3","gravatar_id":"","url":"https://api.github.com/users/j-asis","html_url":"https://github.com/j-asis","followers_url":"https://api.github.com/users/j-asis/followers","following_url":"https://api.github.com/users/j-asis/following{/other_user}","gists_url":"https://api.github.com/users/j-asis/gists{/gist_id}","starred_url":"https://api.github.com/users/j-asis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-asis/subscriptions","organizations_url":"https://api.github.com/users/j-asis/orgs","repos_url":"https://api.github.com/users/j-asis/repos","events_url":"https://api.github.com/users/j-asis/events{/privacy}","received_events_url":"https://api.github.com/users/j-asis/received_events","type":"User","site_admin":false},"repo":{"id":32000660,"name":"Web-Portal","full_name":"j-asis/Web-Portal","owner":{"login":"j-asis","id":10919932,"avatar_url":"https://avatars.githubusercontent.com/u/10919932?v=3","gravatar_id":"","url":"https://api.github.com/users/j-asis","html_url":"https://github.com/j-asis","followers_url":"https://api.github.com/users/j-asis/followers","following_url":"https://api.github.com/users/j-asis/following{/other_user}","gists_url":"https://api.github.com/users/j-asis/gists{/gist_id}","starred_url":"https://api.github.com/users/j-asis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/j-asis/subscriptions","organizations_url":"https://api.github.com/users/j-asis/orgs","repos_url":"https://api.github.com/users/j-asis/repos","events_url":"https://api.github.com/users/j-asis/events{/privacy}","received_events_url":"https://api.github.com/users/j-asis/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/j-asis/Web-Portal","description":"","fork":false,"url":"https://api.github.com/repos/j-asis/Web-Portal","forks_url":"https://api.github.com/repos/j-asis/Web-Portal/forks","keys_url":"https://api.github.com/repos/j-asis/Web-Portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/j-asis/Web-Portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/j-asis/Web-Portal/teams","hooks_url":"https://api.github.com/repos/j-asis/Web-Portal/hooks","issue_events_url":"https://api.github.com/repos/j-asis/Web-Portal/issues/events{/number}","events_url":"https://api.github.com/repos/j-asis/Web-Portal/events","assignees_url":"https://api.github.com/repos/j-asis/Web-Portal/assignees{/user}","branches_url":"https://api.github.com/repos/j-asis/Web-Portal/branches{/branch}","tags_url":"https://api.github.com/repos/j-asis/Web-Portal/tags","blobs_url":"https://api.github.com/repos/j-asis/Web-Portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/j-asis/Web-Portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/j-asis/Web-Portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/j-asis/Web-Portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/j-asis/Web-Portal/statuses/{sha}","languages_url":"https://api.github.com/repos/j-asis/Web-Portal/languages","stargazers_url":"https://api.github.com/repos/j-asis/Web-Portal/stargazers","contributors_url":"https://api.github.com/repos/j-asis/Web-Portal/contributors","subscribers_url":"https://api.github.com/repos/j-asis/Web-Portal/subscribers","subscription_url":"https://api.github.com/repos/j-asis/Web-Portal/subscription","commits_url":"https://api.github.com/repos/j-asis/Web-Portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/j-asis/Web-Portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/j-asis/Web-Portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/j-asis/Web-Portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/j-asis/Web-Portal/contents/{+path}","compare_url":"https://api.github.com/repos/j-asis/Web-Portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/j-asis/Web-Portal/merges","archive_url":"https://api.github.com/repos/j-asis/Web-Portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/j-asis/Web-Portal/downloads","issues_url":"https://api.github.com/repos/j-asis/Web-Portal/issues{/number}","pulls_url":"https://api.github.com/repos/j-asis/Web-Portal/pulls{/number}","milestones_url":"https://api.github.com/repos/j-asis/Web-Portal/milestones{/number}","notifications_url":"https://api.github.com/repos/j-asis/Web-Portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/j-asis/Web-Portal/labels{/name}","releases_url":"https://api.github.com/repos/j-asis/Web-Portal/releases{/id}","created_at":"2015-03-11T05:47:12Z","updated_at":"2015-04-08T02:40:48Z","pushed_at":"2015-04-08T02:40:48Z","git_url":"git://github.com/j-asis/Web-Portal.git","ssh_url":"git@github.com:j-asis/Web-Portal.git","clone_url":"https://github.com/j-asis/Web-Portal.git","svn_url":"https://github.com/j-asis/Web-Portal","homepage":null,"size":484,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"dev_1.1"}},"_links":{"self":{"href":"https://api.github.com/repos/j-asis/Web-Portal/pulls/2"},"html":{"href":"https://github.com/j-asis/Web-Portal/pull/2"},"issue":{"href":"https://api.github.com/repos/j-asis/Web-Portal/issues/2"},"comments":{"href":"https://api.github.com/repos/j-asis/Web-Portal/issues/2/comments"},"review_comments":{"href":"https://api.github.com/repos/j-asis/Web-Portal/pulls/2/comments"},"review_comment":{"href":"https://api.github.com/repos/j-asis/Web-Portal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/j-asis/Web-Portal/pulls/2/commits"},"statuses":{"href":"https://api.github.com/repos/j-asis/Web-Portal/statuses/a42f0738a50a14b01d1e95e3bb03cbc96a96747b"}}}}