{"action":"created","comment":{"url":"https://api.github.com/repos/cluePrints/code-review/pulls/comments/30955395","id":30955395,"diff_hunk":"@@ -0,0 +1,111 @@\n+package ua.goit.gojava32.kickstarter.controller;\n+\n+\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.stereotype.Controller;\n+import org.springframework.web.bind.annotation.*;\n+import org.springframework.web.servlet.ModelAndView;\n+\n+import ua.goit.gojava32.kickstarter.model.Category;\n+import ua.goit.gojava32.kickstarter.model.Project;\n+import ua.goit.gojava32.kickstarter.service.CategoryService;\n+import ua.goit.gojava32.kickstarter.service.CommentService;\n+import ua.goit.gojava32.kickstarter.service.ProjectService;\n+import ua.goit.gojava32.kickstarter.service.UserService;\n+\n+import java.security.Principal;\n+import java.util.List;\n+\n+@Controller\n+public class ProjectController {\n+\n+  @Autowired\n+  ProjectService projectService;\n+  @Autowired\n+  CommentService commentService;\n+  @Autowired\n+  CategoryService categoryService;\n+  @Autowired\n+  UserService userService;\n+\n+  @RequestMapping(value = \"/project/{id}\")\n+  @ResponseBody\n+  public ModelAndView showProject(@PathVariable(\"id\") int id, Principal principal){\n+    Project project = projectService.get(id);\n+    ModelAndView vm = new ModelAndView(\"project\");\n+\n+    vm.addObject(\"project\", project);\n+    vm.addObject(\"category\", project.getCategory());\n+    vm.addObject(\"comments\", projectService.getProjectComments(project));\n+    vm.addObject(\"blogs\", projectService.getProjectBlogPosts(project));\n+    if (principal != null && (project.getUser().getEmail()).equals(principal.getName())) {\n+      vm.addObject(\"showAddBlog\", true);\n+    } else {\n+      vm.addObject(\"showAddBlog\", false);\n+    }\n+\n+    return vm;\n+  }\n+\n+  @RequestMapping(value = \"/project/{id}/delete\")\n+  @ResponseBody\n+  public ModelAndView deleteProject(@PathVariable(\"id\") int id, Principal principal){\n+    Project project = projectService.get(id);\n+    ModelAndView vm;\n+    if (principal != null && (project.getUser().getEmail()).equals(principal.getName())) {","path":"src/main/java/ua/goit/gojava32/kickstarter/controller/ProjectController.java","position":55,"original_position":55,"commit_id":"1bdb0735fc6569a4cd5c730720dfe3f0cbd6e07a","original_commit_id":"1bdb0735fc6569a4cd5c730720dfe3f0cbd6e07a","user":{"login":"cluePrints","id":432728,"avatar_url":"https://avatars.githubusercontent.com/u/432728?v=3","gravatar_id":"","url":"https://api.github.com/users/cluePrints","html_url":"https://github.com/cluePrints","followers_url":"https://api.github.com/users/cluePrints/followers","following_url":"https://api.github.com/users/cluePrints/following{/other_user}","gists_url":"https://api.github.com/users/cluePrints/gists{/gist_id}","starred_url":"https://api.github.com/users/cluePrints/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cluePrints/subscriptions","organizations_url":"https://api.github.com/users/cluePrints/orgs","repos_url":"https://api.github.com/users/cluePrints/repos","events_url":"https://api.github.com/users/cluePrints/events{/privacy}","received_events_url":"https://api.github.com/users/cluePrints/received_events","type":"User","site_admin":false},"body":"access check routine is duplicated --> refactor out to a function","created_at":"2015-05-24T20:12:48Z","updated_at":"2015-05-24T20:12:48Z","html_url":"https://github.com/cluePrints/code-review/pull/6#discussion_r30955395","pull_request_url":"https://api.github.com/repos/cluePrints/code-review/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/cluePrints/code-review/pulls/comments/30955395"},"html":{"href":"https://github.com/cluePrints/code-review/pull/6#discussion_r30955395"},"pull_request":{"href":"https://api.github.com/repos/cluePrints/code-review/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/cluePrints/code-review/pulls/6","id":36107562,"html_url":"https://github.com/cluePrints/code-review/pull/6","diff_url":"https://github.com/cluePrints/code-review/pull/6.diff","patch_url":"https://github.com/cluePrints/code-review/pull/6.patch","issue_url":"https://api.github.com/repos/cluePrints/code-review/issues/6","number":6,"state":"open","locked":false,"title":"for review","user":{"login":"avelit","id":10562866,"avatar_url":"https://avatars.githubusercontent.com/u/10562866?v=3","gravatar_id":"","url":"https://api.github.com/users/avelit","html_url":"https://github.com/avelit","followers_url":"https://api.github.com/users/avelit/followers","following_url":"https://api.github.com/users/avelit/following{/other_user}","gists_url":"https://api.github.com/users/avelit/gists{/gist_id}","starred_url":"https://api.github.com/users/avelit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avelit/subscriptions","organizations_url":"https://api.github.com/users/avelit/orgs","repos_url":"https://api.github.com/users/avelit/repos","events_url":"https://api.github.com/users/avelit/events{/privacy}","received_events_url":"https://api.github.com/users/avelit/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-05-24T19:58:36Z","updated_at":"2015-05-24T20:12:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7d9ea4a1caf98416f15f17abc7da7715d64fd918","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cluePrints/code-review/pulls/6/commits","review_comments_url":"https://api.github.com/repos/cluePrints/code-review/pulls/6/comments","review_comment_url":"https://api.github.com/repos/cluePrints/code-review/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cluePrints/code-review/issues/6/comments","statuses_url":"https://api.github.com/repos/cluePrints/code-review/statuses/1bdb0735fc6569a4cd5c730720dfe3f0cbd6e07a","head":{"label":"avelit:master","ref":"master","sha":"1bdb0735fc6569a4cd5c730720dfe3f0cbd6e07a","user":{"login":"avelit","id":10562866,"avatar_url":"https://avatars.githubusercontent.com/u/10562866?v=3","gravatar_id":"","url":"https://api.github.com/users/avelit","html_url":"https://github.com/avelit","followers_url":"https://api.github.com/users/avelit/followers","following_url":"https://api.github.com/users/avelit/following{/other_user}","gists_url":"https://api.github.com/users/avelit/gists{/gist_id}","starred_url":"https://api.github.com/users/avelit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avelit/subscriptions","organizations_url":"https://api.github.com/users/avelit/orgs","repos_url":"https://api.github.com/users/avelit/repos","events_url":"https://api.github.com/users/avelit/events{/privacy}","received_events_url":"https://api.github.com/users/avelit/received_events","type":"User","site_admin":false},"repo":{"id":36188730,"name":"code-review","full_name":"avelit/code-review","owner":{"login":"avelit","id":10562866,"avatar_url":"https://avatars.githubusercontent.com/u/10562866?v=3","gravatar_id":"","url":"https://api.github.com/users/avelit","html_url":"https://github.com/avelit","followers_url":"https://api.github.com/users/avelit/followers","following_url":"https://api.github.com/users/avelit/following{/other_user}","gists_url":"https://api.github.com/users/avelit/gists{/gist_id}","starred_url":"https://api.github.com/users/avelit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/avelit/subscriptions","organizations_url":"https://api.github.com/users/avelit/orgs","repos_url":"https://api.github.com/users/avelit/repos","events_url":"https://api.github.com/users/avelit/events{/privacy}","received_events_url":"https://api.github.com/users/avelit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/avelit/code-review","description":"Submit a PR against this repo to get me to comment your code","fork":true,"url":"https://api.github.com/repos/avelit/code-review","forks_url":"https://api.github.com/repos/avelit/code-review/forks","keys_url":"https://api.github.com/repos/avelit/code-review/keys{/key_id}","collaborators_url":"https://api.github.com/repos/avelit/code-review/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/avelit/code-review/teams","hooks_url":"https://api.github.com/repos/avelit/code-review/hooks","issue_events_url":"https://api.github.com/repos/avelit/code-review/issues/events{/number}","events_url":"https://api.github.com/repos/avelit/code-review/events","assignees_url":"https://api.github.com/repos/avelit/code-review/assignees{/user}","branches_url":"https://api.github.com/repos/avelit/code-review/branches{/branch}","tags_url":"https://api.github.com/repos/avelit/code-review/tags","blobs_url":"https://api.github.com/repos/avelit/code-review/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/avelit/code-review/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/avelit/code-review/git/refs{/sha}","trees_url":"https://api.github.com/repos/avelit/code-review/git/trees{/sha}","statuses_url":"https://api.github.com/repos/avelit/code-review/statuses/{sha}","languages_url":"https://api.github.com/repos/avelit/code-review/languages","stargazers_url":"https://api.github.com/repos/avelit/code-review/stargazers","contributors_url":"https://api.github.com/repos/avelit/code-review/contributors","subscribers_url":"https://api.github.com/repos/avelit/code-review/subscribers","subscription_url":"https://api.github.com/repos/avelit/code-review/subscription","commits_url":"https://api.github.com/repos/avelit/code-review/commits{/sha}","git_commits_url":"https://api.github.com/repos/avelit/code-review/git/commits{/sha}","comments_url":"https://api.github.com/repos/avelit/code-review/comments{/number}","issue_comment_url":"https://api.github.com/repos/avelit/code-review/issues/comments{/number}","contents_url":"https://api.github.com/repos/avelit/code-review/contents/{+path}","compare_url":"https://api.github.com/repos/avelit/code-review/compare/{base}...{head}","merges_url":"https://api.github.com/repos/avelit/code-review/merges","archive_url":"https://api.github.com/repos/avelit/code-review/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/avelit/code-review/downloads","issues_url":"https://api.github.com/repos/avelit/code-review/issues{/number}","pulls_url":"https://api.github.com/repos/avelit/code-review/pulls{/number}","milestones_url":"https://api.github.com/repos/avelit/code-review/milestones{/number}","notifications_url":"https://api.github.com/repos/avelit/code-review/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/avelit/code-review/labels{/name}","releases_url":"https://api.github.com/repos/avelit/code-review/releases{/id}","created_at":"2015-05-24T19:20:01Z","updated_at":"2015-05-24T19:57:33Z","pushed_at":"2015-05-24T19:57:32Z","git_url":"git://github.com/avelit/code-review.git","ssh_url":"git@github.com:avelit/code-review.git","clone_url":"https://github.com/avelit/code-review.git","svn_url":"https://github.com/avelit/code-review","homepage":null,"size":2335,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cluePrints:master","ref":"master","sha":"5bc66eadf172fed6825e5c1faf87ca61f5818ca5","user":{"login":"cluePrints","id":432728,"avatar_url":"https://avatars.githubusercontent.com/u/432728?v=3","gravatar_id":"","url":"https://api.github.com/users/cluePrints","html_url":"https://github.com/cluePrints","followers_url":"https://api.github.com/users/cluePrints/followers","following_url":"https://api.github.com/users/cluePrints/following{/other_user}","gists_url":"https://api.github.com/users/cluePrints/gists{/gist_id}","starred_url":"https://api.github.com/users/cluePrints/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cluePrints/subscriptions","organizations_url":"https://api.github.com/users/cluePrints/orgs","repos_url":"https://api.github.com/users/cluePrints/repos","events_url":"https://api.github.com/users/cluePrints/events{/privacy}","received_events_url":"https://api.github.com/users/cluePrints/received_events","type":"User","site_admin":false},"repo":{"id":22610972,"name":"code-review","full_name":"cluePrints/code-review","owner":{"login":"cluePrints","id":432728,"avatar_url":"https://avatars.githubusercontent.com/u/432728?v=3","gravatar_id":"","url":"https://api.github.com/users/cluePrints","html_url":"https://github.com/cluePrints","followers_url":"https://api.github.com/users/cluePrints/followers","following_url":"https://api.github.com/users/cluePrints/following{/other_user}","gists_url":"https://api.github.com/users/cluePrints/gists{/gist_id}","starred_url":"https://api.github.com/users/cluePrints/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cluePrints/subscriptions","organizations_url":"https://api.github.com/users/cluePrints/orgs","repos_url":"https://api.github.com/users/cluePrints/repos","events_url":"https://api.github.com/users/cluePrints/events{/privacy}","received_events_url":"https://api.github.com/users/cluePrints/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cluePrints/code-review","description":"Submit a PR against this repo to get me to comment your code","fork":false,"url":"https://api.github.com/repos/cluePrints/code-review","forks_url":"https://api.github.com/repos/cluePrints/code-review/forks","keys_url":"https://api.github.com/repos/cluePrints/code-review/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cluePrints/code-review/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cluePrints/code-review/teams","hooks_url":"https://api.github.com/repos/cluePrints/code-review/hooks","issue_events_url":"https://api.github.com/repos/cluePrints/code-review/issues/events{/number}","events_url":"https://api.github.com/repos/cluePrints/code-review/events","assignees_url":"https://api.github.com/repos/cluePrints/code-review/assignees{/user}","branches_url":"https://api.github.com/repos/cluePrints/code-review/branches{/branch}","tags_url":"https://api.github.com/repos/cluePrints/code-review/tags","blobs_url":"https://api.github.com/repos/cluePrints/code-review/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cluePrints/code-review/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cluePrints/code-review/git/refs{/sha}","trees_url":"https://api.github.com/repos/cluePrints/code-review/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cluePrints/code-review/statuses/{sha}","languages_url":"https://api.github.com/repos/cluePrints/code-review/languages","stargazers_url":"https://api.github.com/repos/cluePrints/code-review/stargazers","contributors_url":"https://api.github.com/repos/cluePrints/code-review/contributors","subscribers_url":"https://api.github.com/repos/cluePrints/code-review/subscribers","subscription_url":"https://api.github.com/repos/cluePrints/code-review/subscription","commits_url":"https://api.github.com/repos/cluePrints/code-review/commits{/sha}","git_commits_url":"https://api.github.com/repos/cluePrints/code-review/git/commits{/sha}","comments_url":"https://api.github.com/repos/cluePrints/code-review/comments{/number}","issue_comment_url":"https://api.github.com/repos/cluePrints/code-review/issues/comments{/number}","contents_url":"https://api.github.com/repos/cluePrints/code-review/contents/{+path}","compare_url":"https://api.github.com/repos/cluePrints/code-review/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cluePrints/code-review/merges","archive_url":"https://api.github.com/repos/cluePrints/code-review/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cluePrints/code-review/downloads","issues_url":"https://api.github.com/repos/cluePrints/code-review/issues{/number}","pulls_url":"https://api.github.com/repos/cluePrints/code-review/pulls{/number}","milestones_url":"https://api.github.com/repos/cluePrints/code-review/milestones{/number}","notifications_url":"https://api.github.com/repos/cluePrints/code-review/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cluePrints/code-review/labels{/name}","releases_url":"https://api.github.com/repos/cluePrints/code-review/releases{/id}","created_at":"2014-08-04T16:15:36Z","updated_at":"2014-08-04T16:15:36Z","pushed_at":"2015-05-24T19:58:37Z","git_url":"git://github.com/cluePrints/code-review.git","ssh_url":"git@github.com:cluePrints/code-review.git","clone_url":"https://github.com/cluePrints/code-review.git","svn_url":"https://github.com/cluePrints/code-review","homepage":null,"size":2335,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":6,"forks":5,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cluePrints/code-review/pulls/6"},"html":{"href":"https://github.com/cluePrints/code-review/pull/6"},"issue":{"href":"https://api.github.com/repos/cluePrints/code-review/issues/6"},"comments":{"href":"https://api.github.com/repos/cluePrints/code-review/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/cluePrints/code-review/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/cluePrints/code-review/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cluePrints/code-review/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/cluePrints/code-review/statuses/1bdb0735fc6569a4cd5c730720dfe3f0cbd6e07a"}}}}