{"action":"created","comment":{"url":"https://api.github.com/repos/jiexu10/pinpoint/pulls/comments/50757733","id":50757733,"diff_hunk":"@@ -1,25 +1,41 @@\n class OrdersController < ApplicationController\n   def show\n     @order = Order.find(params[:id])\n-    @cart = @order.cart if @order.cart.status == 'ordered'\n+    if current_user == @order.user\n+      @cart = @order.cart if @order.cart.status == 'ordered'\n+    else\n+      flash[:notice] = 'Action not permitted.'\n+      redirect_to root_path\n+    end\n   end\n \n   def create\n     cart = Cart.find(order_params[:cart_id])\n     restaurant = Restaurant.find(order_params[:restaurant_id])\n-    order = Order.new(cart: cart, restaurant: restaurant, user: current_user)\n+    pending_status = Status.find_by(name: 'Pending')\n+    order = Order.new(cart: cart, restaurant: restaurant, status: pending_status, user: current_user)","path":"app/controllers/orders_controller.rb","position":18,"original_position":18,"commit_id":"de27ca5c159cd9a5db6ca52edfba7ae7f60e6759","original_commit_id":"de27ca5c159cd9a5db6ca52edfba7ae7f60e6759","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Line is too long. [101/80]","created_at":"2016-01-25T21:20:10Z","updated_at":"2016-01-25T21:20:10Z","html_url":"https://github.com/jiexu10/pinpoint/pull/67#discussion_r50757733","pull_request_url":"https://api.github.com/repos/jiexu10/pinpoint/pulls/67","_links":{"self":{"href":"https://api.github.com/repos/jiexu10/pinpoint/pulls/comments/50757733"},"html":{"href":"https://github.com/jiexu10/pinpoint/pull/67#discussion_r50757733"},"pull_request":{"href":"https://api.github.com/repos/jiexu10/pinpoint/pulls/67"}}},"pull_request":{"url":"https://api.github.com/repos/jiexu10/pinpoint/pulls/67","id":57132191,"html_url":"https://github.com/jiexu10/pinpoint/pull/67","diff_url":"https://github.com/jiexu10/pinpoint/pull/67.diff","patch_url":"https://github.com/jiexu10/pinpoint/pull/67.patch","issue_url":"https://api.github.com/repos/jiexu10/pinpoint/issues/67","number":67,"state":"open","locked":false,"title":"[Resolves #15] restaurant change order status","user":{"login":"jiexu10","id":12928368,"avatar_url":"https://avatars.githubusercontent.com/u/12928368?v=3","gravatar_id":"","url":"https://api.github.com/users/jiexu10","html_url":"https://github.com/jiexu10","followers_url":"https://api.github.com/users/jiexu10/followers","following_url":"https://api.github.com/users/jiexu10/following{/other_user}","gists_url":"https://api.github.com/users/jiexu10/gists{/gist_id}","starred_url":"https://api.github.com/users/jiexu10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiexu10/subscriptions","organizations_url":"https://api.github.com/users/jiexu10/orgs","repos_url":"https://api.github.com/users/jiexu10/repos","events_url":"https://api.github.com/users/jiexu10/events{/privacy}","received_events_url":"https://api.github.com/users/jiexu10/received_events","type":"User","site_admin":false},"body":"#15 ","created_at":"2016-01-25T21:19:57Z","updated_at":"2016-01-25T21:20:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e505fb80c6f9b4c22d6ad3f742a2b23b07c143c8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jiexu10/pinpoint/pulls/67/commits","review_comments_url":"https://api.github.com/repos/jiexu10/pinpoint/pulls/67/comments","review_comment_url":"https://api.github.com/repos/jiexu10/pinpoint/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jiexu10/pinpoint/issues/67/comments","statuses_url":"https://api.github.com/repos/jiexu10/pinpoint/statuses/de27ca5c159cd9a5db6ca52edfba7ae7f60e6759","head":{"label":"jiexu10:jx-15-restaurant-change-order-status","ref":"jx-15-restaurant-change-order-status","sha":"de27ca5c159cd9a5db6ca52edfba7ae7f60e6759","user":{"login":"jiexu10","id":12928368,"avatar_url":"https://avatars.githubusercontent.com/u/12928368?v=3","gravatar_id":"","url":"https://api.github.com/users/jiexu10","html_url":"https://github.com/jiexu10","followers_url":"https://api.github.com/users/jiexu10/followers","following_url":"https://api.github.com/users/jiexu10/following{/other_user}","gists_url":"https://api.github.com/users/jiexu10/gists{/gist_id}","starred_url":"https://api.github.com/users/jiexu10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiexu10/subscriptions","organizations_url":"https://api.github.com/users/jiexu10/orgs","repos_url":"https://api.github.com/users/jiexu10/repos","events_url":"https://api.github.com/users/jiexu10/events{/privacy}","received_events_url":"https://api.github.com/users/jiexu10/received_events","type":"User","site_admin":false},"repo":{"id":49346910,"name":"pinpoint","full_name":"jiexu10/pinpoint","owner":{"login":"jiexu10","id":12928368,"avatar_url":"https://avatars.githubusercontent.com/u/12928368?v=3","gravatar_id":"","url":"https://api.github.com/users/jiexu10","html_url":"https://github.com/jiexu10","followers_url":"https://api.github.com/users/jiexu10/followers","following_url":"https://api.github.com/users/jiexu10/following{/other_user}","gists_url":"https://api.github.com/users/jiexu10/gists{/gist_id}","starred_url":"https://api.github.com/users/jiexu10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiexu10/subscriptions","organizations_url":"https://api.github.com/users/jiexu10/orgs","repos_url":"https://api.github.com/users/jiexu10/repos","events_url":"https://api.github.com/users/jiexu10/events{/privacy}","received_events_url":"https://api.github.com/users/jiexu10/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jiexu10/pinpoint","description":"Pinpoint App - Find your Food","fork":false,"url":"https://api.github.com/repos/jiexu10/pinpoint","forks_url":"https://api.github.com/repos/jiexu10/pinpoint/forks","keys_url":"https://api.github.com/repos/jiexu10/pinpoint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jiexu10/pinpoint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jiexu10/pinpoint/teams","hooks_url":"https://api.github.com/repos/jiexu10/pinpoint/hooks","issue_events_url":"https://api.github.com/repos/jiexu10/pinpoint/issues/events{/number}","events_url":"https://api.github.com/repos/jiexu10/pinpoint/events","assignees_url":"https://api.github.com/repos/jiexu10/pinpoint/assignees{/user}","branches_url":"https://api.github.com/repos/jiexu10/pinpoint/branches{/branch}","tags_url":"https://api.github.com/repos/jiexu10/pinpoint/tags","blobs_url":"https://api.github.com/repos/jiexu10/pinpoint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jiexu10/pinpoint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jiexu10/pinpoint/git/refs{/sha}","trees_url":"https://api.github.com/repos/jiexu10/pinpoint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jiexu10/pinpoint/statuses/{sha}","languages_url":"https://api.github.com/repos/jiexu10/pinpoint/languages","stargazers_url":"https://api.github.com/repos/jiexu10/pinpoint/stargazers","contributors_url":"https://api.github.com/repos/jiexu10/pinpoint/contributors","subscribers_url":"https://api.github.com/repos/jiexu10/pinpoint/subscribers","subscription_url":"https://api.github.com/repos/jiexu10/pinpoint/subscription","commits_url":"https://api.github.com/repos/jiexu10/pinpoint/commits{/sha}","git_commits_url":"https://api.github.com/repos/jiexu10/pinpoint/git/commits{/sha}","comments_url":"https://api.github.com/repos/jiexu10/pinpoint/comments{/number}","issue_comment_url":"https://api.github.com/repos/jiexu10/pinpoint/issues/comments{/number}","contents_url":"https://api.github.com/repos/jiexu10/pinpoint/contents/{+path}","compare_url":"https://api.github.com/repos/jiexu10/pinpoint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jiexu10/pinpoint/merges","archive_url":"https://api.github.com/repos/jiexu10/pinpoint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jiexu10/pinpoint/downloads","issues_url":"https://api.github.com/repos/jiexu10/pinpoint/issues{/number}","pulls_url":"https://api.github.com/repos/jiexu10/pinpoint/pulls{/number}","milestones_url":"https://api.github.com/repos/jiexu10/pinpoint/milestones{/number}","notifications_url":"https://api.github.com/repos/jiexu10/pinpoint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jiexu10/pinpoint/labels{/name}","releases_url":"https://api.github.com/repos/jiexu10/pinpoint/releases{/id}","deployments_url":"https://api.github.com/repos/jiexu10/pinpoint/deployments","created_at":"2016-01-10T00:12:40Z","updated_at":"2016-01-21T01:42:57Z","pushed_at":"2016-01-25T21:19:58Z","git_url":"git://github.com/jiexu10/pinpoint.git","ssh_url":"git@github.com:jiexu10/pinpoint.git","clone_url":"https://github.com/jiexu10/pinpoint.git","svn_url":"https://github.com/jiexu10/pinpoint","homepage":"https://pinpoint-food.herokuapp.com","size":3056,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":1,"default_branch":"master"}},"base":{"label":"jiexu10:master","ref":"master","sha":"5ed914ba345e93b56bb077793ef7270ae73d79a5","user":{"login":"jiexu10","id":12928368,"avatar_url":"https://avatars.githubusercontent.com/u/12928368?v=3","gravatar_id":"","url":"https://api.github.com/users/jiexu10","html_url":"https://github.com/jiexu10","followers_url":"https://api.github.com/users/jiexu10/followers","following_url":"https://api.github.com/users/jiexu10/following{/other_user}","gists_url":"https://api.github.com/users/jiexu10/gists{/gist_id}","starred_url":"https://api.github.com/users/jiexu10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiexu10/subscriptions","organizations_url":"https://api.github.com/users/jiexu10/orgs","repos_url":"https://api.github.com/users/jiexu10/repos","events_url":"https://api.github.com/users/jiexu10/events{/privacy}","received_events_url":"https://api.github.com/users/jiexu10/received_events","type":"User","site_admin":false},"repo":{"id":49346910,"name":"pinpoint","full_name":"jiexu10/pinpoint","owner":{"login":"jiexu10","id":12928368,"avatar_url":"https://avatars.githubusercontent.com/u/12928368?v=3","gravatar_id":"","url":"https://api.github.com/users/jiexu10","html_url":"https://github.com/jiexu10","followers_url":"https://api.github.com/users/jiexu10/followers","following_url":"https://api.github.com/users/jiexu10/following{/other_user}","gists_url":"https://api.github.com/users/jiexu10/gists{/gist_id}","starred_url":"https://api.github.com/users/jiexu10/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jiexu10/subscriptions","organizations_url":"https://api.github.com/users/jiexu10/orgs","repos_url":"https://api.github.com/users/jiexu10/repos","events_url":"https://api.github.com/users/jiexu10/events{/privacy}","received_events_url":"https://api.github.com/users/jiexu10/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jiexu10/pinpoint","description":"Pinpoint App - Find your Food","fork":false,"url":"https://api.github.com/repos/jiexu10/pinpoint","forks_url":"https://api.github.com/repos/jiexu10/pinpoint/forks","keys_url":"https://api.github.com/repos/jiexu10/pinpoint/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jiexu10/pinpoint/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jiexu10/pinpoint/teams","hooks_url":"https://api.github.com/repos/jiexu10/pinpoint/hooks","issue_events_url":"https://api.github.com/repos/jiexu10/pinpoint/issues/events{/number}","events_url":"https://api.github.com/repos/jiexu10/pinpoint/events","assignees_url":"https://api.github.com/repos/jiexu10/pinpoint/assignees{/user}","branches_url":"https://api.github.com/repos/jiexu10/pinpoint/branches{/branch}","tags_url":"https://api.github.com/repos/jiexu10/pinpoint/tags","blobs_url":"https://api.github.com/repos/jiexu10/pinpoint/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jiexu10/pinpoint/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jiexu10/pinpoint/git/refs{/sha}","trees_url":"https://api.github.com/repos/jiexu10/pinpoint/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jiexu10/pinpoint/statuses/{sha}","languages_url":"https://api.github.com/repos/jiexu10/pinpoint/languages","stargazers_url":"https://api.github.com/repos/jiexu10/pinpoint/stargazers","contributors_url":"https://api.github.com/repos/jiexu10/pinpoint/contributors","subscribers_url":"https://api.github.com/repos/jiexu10/pinpoint/subscribers","subscription_url":"https://api.github.com/repos/jiexu10/pinpoint/subscription","commits_url":"https://api.github.com/repos/jiexu10/pinpoint/commits{/sha}","git_commits_url":"https://api.github.com/repos/jiexu10/pinpoint/git/commits{/sha}","comments_url":"https://api.github.com/repos/jiexu10/pinpoint/comments{/number}","issue_comment_url":"https://api.github.com/repos/jiexu10/pinpoint/issues/comments{/number}","contents_url":"https://api.github.com/repos/jiexu10/pinpoint/contents/{+path}","compare_url":"https://api.github.com/repos/jiexu10/pinpoint/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jiexu10/pinpoint/merges","archive_url":"https://api.github.com/repos/jiexu10/pinpoint/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jiexu10/pinpoint/downloads","issues_url":"https://api.github.com/repos/jiexu10/pinpoint/issues{/number}","pulls_url":"https://api.github.com/repos/jiexu10/pinpoint/pulls{/number}","milestones_url":"https://api.github.com/repos/jiexu10/pinpoint/milestones{/number}","notifications_url":"https://api.github.com/repos/jiexu10/pinpoint/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jiexu10/pinpoint/labels{/name}","releases_url":"https://api.github.com/repos/jiexu10/pinpoint/releases{/id}","deployments_url":"https://api.github.com/repos/jiexu10/pinpoint/deployments","created_at":"2016-01-10T00:12:40Z","updated_at":"2016-01-21T01:42:57Z","pushed_at":"2016-01-25T21:19:58Z","git_url":"git://github.com/jiexu10/pinpoint.git","ssh_url":"git@github.com:jiexu10/pinpoint.git","clone_url":"https://github.com/jiexu10/pinpoint.git","svn_url":"https://github.com/jiexu10/pinpoint","homepage":"https://pinpoint-food.herokuapp.com","size":3056,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jiexu10/pinpoint/pulls/67"},"html":{"href":"https://github.com/jiexu10/pinpoint/pull/67"},"issue":{"href":"https://api.github.com/repos/jiexu10/pinpoint/issues/67"},"comments":{"href":"https://api.github.com/repos/jiexu10/pinpoint/issues/67/comments"},"review_comments":{"href":"https://api.github.com/repos/jiexu10/pinpoint/pulls/67/comments"},"review_comment":{"href":"https://api.github.com/repos/jiexu10/pinpoint/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jiexu10/pinpoint/pulls/67/commits"},"statuses":{"href":"https://api.github.com/repos/jiexu10/pinpoint/statuses/de27ca5c159cd9a5db6ca52edfba7ae7f60e6759"}}}}