{"action":"created","comment":{"url":"https://api.github.com/repos/Mentessi/toastmasters/pulls/comments/184162026","pull_request_review_id":115299037,"id":184162026,"diff_hunk":"@@ -28,6 +30,9 @@ def destroy\n   end\n \n   def edit\n+    unless @topic.user_id == current_user.id\n+      render :show\n+    end","path":"app/controllers/topics_controller.rb","position":24,"original_position":24,"commit_id":"f22b004c8dcc5bda3e0d3c28992efcd0a7a98193","original_commit_id":"f22b004c8dcc5bda3e0d3c28992efcd0a7a98193","user":{"login":"Neilos","id":977566,"avatar_url":"https://avatars3.githubusercontent.com/u/977566?v=4","gravatar_id":"","url":"https://api.github.com/users/Neilos","html_url":"https://github.com/Neilos","followers_url":"https://api.github.com/users/Neilos/followers","following_url":"https://api.github.com/users/Neilos/following{/other_user}","gists_url":"https://api.github.com/users/Neilos/gists{/gist_id}","starred_url":"https://api.github.com/users/Neilos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Neilos/subscriptions","organizations_url":"https://api.github.com/users/Neilos/orgs","repos_url":"https://api.github.com/users/Neilos/repos","events_url":"https://api.github.com/users/Neilos/events{/privacy}","received_events_url":"https://api.github.com/users/Neilos/received_events","type":"User","site_admin":false},"body":"Again, this works, but it would be better to just scope the finding of the topic to the current user. Then if the current_user doesn't own the topic you return a 404, as if it didn't even exist.\r\n\r\n```ruby\r\n@topic = current_user.topics.find(params[:id])\r\nrender :show\r\n```\r\n\r\n...but this should be driven by a test: a request spec.","created_at":"2018-04-25T18:25:27Z","updated_at":"2018-04-25T18:27:29Z","html_url":"https://github.com/Mentessi/toastmasters/pull/10#discussion_r184162026","pull_request_url":"https://api.github.com/repos/Mentessi/toastmasters/pulls/10","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/Mentessi/toastmasters/pulls/comments/184162026"},"html":{"href":"https://github.com/Mentessi/toastmasters/pull/10#discussion_r184162026"},"pull_request":{"href":"https://api.github.com/repos/Mentessi/toastmasters/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/Mentessi/toastmasters/pulls/10","id":180172980,"html_url":"https://github.com/Mentessi/toastmasters/pull/10","diff_url":"https://github.com/Mentessi/toastmasters/pull/10.diff","patch_url":"https://github.com/Mentessi/toastmasters/pull/10.patch","issue_url":"https://api.github.com/repos/Mentessi/toastmasters/issues/10","number":10,"state":"open","locked":false,"title":"Topics belong to users","user":{"login":"Mentessi","id":1826464,"avatar_url":"https://avatars0.githubusercontent.com/u/1826464?v=4","gravatar_id":"","url":"https://api.github.com/users/Mentessi","html_url":"https://github.com/Mentessi","followers_url":"https://api.github.com/users/Mentessi/followers","following_url":"https://api.github.com/users/Mentessi/following{/other_user}","gists_url":"https://api.github.com/users/Mentessi/gists{/gist_id}","starred_url":"https://api.github.com/users/Mentessi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mentessi/subscriptions","organizations_url":"https://api.github.com/users/Mentessi/orgs","repos_url":"https://api.github.com/users/Mentessi/repos","events_url":"https://api.github.com/users/Mentessi/events{/privacy}","received_events_url":"https://api.github.com/users/Mentessi/received_events","type":"User","site_admin":false},"body":"Based off of #7 \r\nFor just changes for this PR see https://github.com/Mentessi/toastmasters/compare/only-logged-in-users...topics-belong-to-users\r\n\r\n-------------\r\n\r\nWhoooah - this felt like a big improvement from a workflow perspective. I have rebased and sorted out the commit order & content to get closer to something that is incrementally deployable (dont think I've quite nailed commit messages yet). Covered database associations, 'shoulda' gem for tests, restricted what the user sees based on whether it's their own topic or not and tested it all too. Obviously they'll be stuff that I haven't done quite right, but actually chuffed with my progress - you'll make a developer out of me yet dude!! :-D","created_at":"2018-04-08T18:26:40Z","updated_at":"2018-04-25T18:27:29Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4d9b564769def0e58ffbcd2e83cad0073ab43dcc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/Mentessi/toastmasters/pulls/10/commits","review_comments_url":"https://api.github.com/repos/Mentessi/toastmasters/pulls/10/comments","review_comment_url":"https://api.github.com/repos/Mentessi/toastmasters/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Mentessi/toastmasters/issues/10/comments","statuses_url":"https://api.github.com/repos/Mentessi/toastmasters/statuses/f22b004c8dcc5bda3e0d3c28992efcd0a7a98193","head":{"label":"Mentessi:topics-belong-to-users","ref":"topics-belong-to-users","sha":"f22b004c8dcc5bda3e0d3c28992efcd0a7a98193","user":{"login":"Mentessi","id":1826464,"avatar_url":"https://avatars0.githubusercontent.com/u/1826464?v=4","gravatar_id":"","url":"https://api.github.com/users/Mentessi","html_url":"https://github.com/Mentessi","followers_url":"https://api.github.com/users/Mentessi/followers","following_url":"https://api.github.com/users/Mentessi/following{/other_user}","gists_url":"https://api.github.com/users/Mentessi/gists{/gist_id}","starred_url":"https://api.github.com/users/Mentessi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mentessi/subscriptions","organizations_url":"https://api.github.com/users/Mentessi/orgs","repos_url":"https://api.github.com/users/Mentessi/repos","events_url":"https://api.github.com/users/Mentessi/events{/privacy}","received_events_url":"https://api.github.com/users/Mentessi/received_events","type":"User","site_admin":false},"repo":{"id":120593299,"name":"toastmasters","full_name":"Mentessi/toastmasters","owner":{"login":"Mentessi","id":1826464,"avatar_url":"https://avatars0.githubusercontent.com/u/1826464?v=4","gravatar_id":"","url":"https://api.github.com/users/Mentessi","html_url":"https://github.com/Mentessi","followers_url":"https://api.github.com/users/Mentessi/followers","following_url":"https://api.github.com/users/Mentessi/following{/other_user}","gists_url":"https://api.github.com/users/Mentessi/gists{/gist_id}","starred_url":"https://api.github.com/users/Mentessi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mentessi/subscriptions","organizations_url":"https://api.github.com/users/Mentessi/orgs","repos_url":"https://api.github.com/users/Mentessi/repos","events_url":"https://api.github.com/users/Mentessi/events{/privacy}","received_events_url":"https://api.github.com/users/Mentessi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mentessi/toastmasters","description":null,"fork":false,"url":"https://api.github.com/repos/Mentessi/toastmasters","forks_url":"https://api.github.com/repos/Mentessi/toastmasters/forks","keys_url":"https://api.github.com/repos/Mentessi/toastmasters/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mentessi/toastmasters/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mentessi/toastmasters/teams","hooks_url":"https://api.github.com/repos/Mentessi/toastmasters/hooks","issue_events_url":"https://api.github.com/repos/Mentessi/toastmasters/issues/events{/number}","events_url":"https://api.github.com/repos/Mentessi/toastmasters/events","assignees_url":"https://api.github.com/repos/Mentessi/toastmasters/assignees{/user}","branches_url":"https://api.github.com/repos/Mentessi/toastmasters/branches{/branch}","tags_url":"https://api.github.com/repos/Mentessi/toastmasters/tags","blobs_url":"https://api.github.com/repos/Mentessi/toastmasters/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mentessi/toastmasters/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mentessi/toastmasters/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mentessi/toastmasters/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mentessi/toastmasters/statuses/{sha}","languages_url":"https://api.github.com/repos/Mentessi/toastmasters/languages","stargazers_url":"https://api.github.com/repos/Mentessi/toastmasters/stargazers","contributors_url":"https://api.github.com/repos/Mentessi/toastmasters/contributors","subscribers_url":"https://api.github.com/repos/Mentessi/toastmasters/subscribers","subscription_url":"https://api.github.com/repos/Mentessi/toastmasters/subscription","commits_url":"https://api.github.com/repos/Mentessi/toastmasters/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mentessi/toastmasters/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mentessi/toastmasters/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mentessi/toastmasters/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mentessi/toastmasters/contents/{+path}","compare_url":"https://api.github.com/repos/Mentessi/toastmasters/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mentessi/toastmasters/merges","archive_url":"https://api.github.com/repos/Mentessi/toastmasters/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mentessi/toastmasters/downloads","issues_url":"https://api.github.com/repos/Mentessi/toastmasters/issues{/number}","pulls_url":"https://api.github.com/repos/Mentessi/toastmasters/pulls{/number}","milestones_url":"https://api.github.com/repos/Mentessi/toastmasters/milestones{/number}","notifications_url":"https://api.github.com/repos/Mentessi/toastmasters/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mentessi/toastmasters/labels{/name}","releases_url":"https://api.github.com/repos/Mentessi/toastmasters/releases{/id}","deployments_url":"https://api.github.com/repos/Mentessi/toastmasters/deployments","created_at":"2018-02-07T09:28:32Z","updated_at":"2018-04-17T07:05:43Z","pushed_at":"2018-04-24T07:34:33Z","git_url":"git://github.com/Mentessi/toastmasters.git","ssh_url":"git@github.com:Mentessi/toastmasters.git","clone_url":"https://github.com/Mentessi/toastmasters.git","svn_url":"https://github.com/Mentessi/toastmasters","homepage":null,"size":77,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":1,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"Mentessi:master","ref":"master","sha":"7017e5c7efaf0803bd2c96841ca307b5ad1f2b8c","user":{"login":"Mentessi","id":1826464,"avatar_url":"https://avatars0.githubusercontent.com/u/1826464?v=4","gravatar_id":"","url":"https://api.github.com/users/Mentessi","html_url":"https://github.com/Mentessi","followers_url":"https://api.github.com/users/Mentessi/followers","following_url":"https://api.github.com/users/Mentessi/following{/other_user}","gists_url":"https://api.github.com/users/Mentessi/gists{/gist_id}","starred_url":"https://api.github.com/users/Mentessi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mentessi/subscriptions","organizations_url":"https://api.github.com/users/Mentessi/orgs","repos_url":"https://api.github.com/users/Mentessi/repos","events_url":"https://api.github.com/users/Mentessi/events{/privacy}","received_events_url":"https://api.github.com/users/Mentessi/received_events","type":"User","site_admin":false},"repo":{"id":120593299,"name":"toastmasters","full_name":"Mentessi/toastmasters","owner":{"login":"Mentessi","id":1826464,"avatar_url":"https://avatars0.githubusercontent.com/u/1826464?v=4","gravatar_id":"","url":"https://api.github.com/users/Mentessi","html_url":"https://github.com/Mentessi","followers_url":"https://api.github.com/users/Mentessi/followers","following_url":"https://api.github.com/users/Mentessi/following{/other_user}","gists_url":"https://api.github.com/users/Mentessi/gists{/gist_id}","starred_url":"https://api.github.com/users/Mentessi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mentessi/subscriptions","organizations_url":"https://api.github.com/users/Mentessi/orgs","repos_url":"https://api.github.com/users/Mentessi/repos","events_url":"https://api.github.com/users/Mentessi/events{/privacy}","received_events_url":"https://api.github.com/users/Mentessi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mentessi/toastmasters","description":null,"fork":false,"url":"https://api.github.com/repos/Mentessi/toastmasters","forks_url":"https://api.github.com/repos/Mentessi/toastmasters/forks","keys_url":"https://api.github.com/repos/Mentessi/toastmasters/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mentessi/toastmasters/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mentessi/toastmasters/teams","hooks_url":"https://api.github.com/repos/Mentessi/toastmasters/hooks","issue_events_url":"https://api.github.com/repos/Mentessi/toastmasters/issues/events{/number}","events_url":"https://api.github.com/repos/Mentessi/toastmasters/events","assignees_url":"https://api.github.com/repos/Mentessi/toastmasters/assignees{/user}","branches_url":"https://api.github.com/repos/Mentessi/toastmasters/branches{/branch}","tags_url":"https://api.github.com/repos/Mentessi/toastmasters/tags","blobs_url":"https://api.github.com/repos/Mentessi/toastmasters/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mentessi/toastmasters/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mentessi/toastmasters/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mentessi/toastmasters/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mentessi/toastmasters/statuses/{sha}","languages_url":"https://api.github.com/repos/Mentessi/toastmasters/languages","stargazers_url":"https://api.github.com/repos/Mentessi/toastmasters/stargazers","contributors_url":"https://api.github.com/repos/Mentessi/toastmasters/contributors","subscribers_url":"https://api.github.com/repos/Mentessi/toastmasters/subscribers","subscription_url":"https://api.github.com/repos/Mentessi/toastmasters/subscription","commits_url":"https://api.github.com/repos/Mentessi/toastmasters/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mentessi/toastmasters/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mentessi/toastmasters/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mentessi/toastmasters/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mentessi/toastmasters/contents/{+path}","compare_url":"https://api.github.com/repos/Mentessi/toastmasters/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mentessi/toastmasters/merges","archive_url":"https://api.github.com/repos/Mentessi/toastmasters/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mentessi/toastmasters/downloads","issues_url":"https://api.github.com/repos/Mentessi/toastmasters/issues{/number}","pulls_url":"https://api.github.com/repos/Mentessi/toastmasters/pulls{/number}","milestones_url":"https://api.github.com/repos/Mentessi/toastmasters/milestones{/number}","notifications_url":"https://api.github.com/repos/Mentessi/toastmasters/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mentessi/toastmasters/labels{/name}","releases_url":"https://api.github.com/repos/Mentessi/toastmasters/releases{/id}","deployments_url":"https://api.github.com/repos/Mentessi/toastmasters/deployments","created_at":"2018-02-07T09:28:32Z","updated_at":"2018-04-17T07:05:43Z","pushed_at":"2018-04-24T07:34:33Z","git_url":"git://github.com/Mentessi/toastmasters.git","ssh_url":"git@github.com:Mentessi/toastmasters.git","clone_url":"https://github.com/Mentessi/toastmasters.git","svn_url":"https://github.com/Mentessi/toastmasters","homepage":null,"size":77,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":1,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Mentessi/toastmasters/pulls/10"},"html":{"href":"https://github.com/Mentessi/toastmasters/pull/10"},"issue":{"href":"https://api.github.com/repos/Mentessi/toastmasters/issues/10"},"comments":{"href":"https://api.github.com/repos/Mentessi/toastmasters/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/Mentessi/toastmasters/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/Mentessi/toastmasters/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Mentessi/toastmasters/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/Mentessi/toastmasters/statuses/f22b004c8dcc5bda3e0d3c28992efcd0a7a98193"}},"author_association":"OWNER"}}
{"actor":{"display_login":"Neilos"}}