{"action":"created","comment":{"url":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/comments/228261155","pull_request_review_id":168490554,"id":228261155,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyODI2MTE1NQ==","diff_hunk":"@@ -36,15 +80,96 @@ class MuralShowContainer extends Component {\n       .then(response => response.json())\n       .then(body => {\n         this.setState({ mural: body });\n+        this.getReviews()\n+      })\n+      .catch(error => console.error(`Error in fetch: ${error.message}`));\n+\n+    fetch(`/api/v1/user`)\n+      .then(response => {\n+          if (response.ok) {\n+          return response;\n+        } else {\n+          let errorMessage = `${response.status} (${response.statusText})`,\n+              error = new Error(errorMessage);\n+          throw(error);\n+        }\n+      })\n+      .then(response => response.json())\n+      .then(body => {\n+        this.setState({ currentUser: body });\n       })\n       .catch(error => console.error(`Error in fetch: ${error.message}`));\n+    }\n+\n+\n+  handleCommentChange(evt){\n+    this.setState({comment: evt.target.value})\n+  }\n+\n+  handleRatingChange(evt){\n+    this.setState({rating: evt.target.value})\n   }\n \n+  handleSubmit(event){\n+    event.preventDefault()\n+    let payloadRating = parseInt(this.state.rating,10)\n+    let review = {\n+      comment:this.state.comment,\n+      rating:payloadRating,\n+      user_id:this.state.currentUser.id,\n+      mural_id:this.state.mural.id\n+    }\n+    this.submitNewReview(review)\n+  }\n+\n+  submitNewReview(payload){\n+    fetch ('/api/v1/reviews', {\n+      method: 'POST',\n+      body: JSON.stringify(payload),\n+      credentials: 'same-origin',\n+      headers: {\n+       'Content-Type': 'application/json',\n+       'X-Requested-With': 'XMLHttpRequest'\n+      }\n+    })\n+    .then(response => {\n+      if (response.ok) {\n+        return response;\n+      } else {\n+        let errorMessage = `${response.status} (${response.statusText})`,\n+        error = new Error(errorMessage);\n+        throw(error);\n+      }\n+    })\n+    .then(response => response.json())\n+    .then(body => {\n+      let newReviews = this.state.reviews.concat(body)\n+      this.setState({ reviews :newReviews })\n+    })\n+    .catch(error => console.error('Error:', error));\n+  }\n+\n+\n   render() {\n+    let outputReviews = this.state.reviews.map((review) => {\n+      return(\n+        <li key={review.id} className =\"reviewList\"><p>Comment: {review.comment} || Rating: {review.rating}</p></li>\n+      )\n+    })\n+","path":"app/javascript/react/containers/MuralShowContainer.js","position":140,"original_position":140,"commit_id":"09a6a691a4ef9ce0a38df8020565d50a07704436","original_commit_id":"09a6a691a4ef9ce0a38df8020565d50a07704436","user":{"login":"nwalberts","id":16418059,"node_id":"MDQ6VXNlcjE2NDE4MDU5","avatar_url":"https://avatars2.githubusercontent.com/u/16418059?v=4","gravatar_id":"","url":"https://api.github.com/users/nwalberts","html_url":"https://github.com/nwalberts","followers_url":"https://api.github.com/users/nwalberts/followers","following_url":"https://api.github.com/users/nwalberts/following{/other_user}","gists_url":"https://api.github.com/users/nwalberts/gists{/gist_id}","starred_url":"https://api.github.com/users/nwalberts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nwalberts/subscriptions","organizations_url":"https://api.github.com/users/nwalberts/orgs","repos_url":"https://api.github.com/users/nwalberts/repos","events_url":"https://api.github.com/users/nwalberts/events{/privacy}","received_events_url":"https://api.github.com/users/nwalberts/received_events","type":"User","site_admin":false},"body":"This _should_ be componenets as reviews","created_at":"2018-10-25T17:16:27Z","updated_at":"2018-10-25T17:17:27Z","html_url":"https://github.com/MrBlooKangaroo/muralis/pull/9#discussion_r228261155","pull_request_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/9","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/comments/228261155"},"html":{"href":"https://github.com/MrBlooKangaroo/muralis/pull/9#discussion_r228261155"},"pull_request":{"href":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/9"}}},"pull_request":{"url":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/9","id":224397604,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI0Mzk3NjA0","html_url":"https://github.com/MrBlooKangaroo/muralis/pull/9","diff_url":"https://github.com/MrBlooKangaroo/muralis/pull/9.diff","patch_url":"https://github.com/MrBlooKangaroo/muralis/pull/9.patch","issue_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/issues/9","number":9,"state":"open","locked":false,"title":"Review form api","user":{"login":"DanielCoffey1","id":43078566,"node_id":"MDQ6VXNlcjQzMDc4NTY2","avatar_url":"https://avatars0.githubusercontent.com/u/43078566?v=4","gravatar_id":"","url":"https://api.github.com/users/DanielCoffey1","html_url":"https://github.com/DanielCoffey1","followers_url":"https://api.github.com/users/DanielCoffey1/followers","following_url":"https://api.github.com/users/DanielCoffey1/following{/other_user}","gists_url":"https://api.github.com/users/DanielCoffey1/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielCoffey1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielCoffey1/subscriptions","organizations_url":"https://api.github.com/users/DanielCoffey1/orgs","repos_url":"https://api.github.com/users/DanielCoffey1/repos","events_url":"https://api.github.com/users/DanielCoffey1/events{/privacy}","received_events_url":"https://api.github.com/users/DanielCoffey1/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-10-19T20:10:50Z","updated_at":"2018-10-25T17:17:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"59301e3d3b19970b56a0cd1e14865b625a87c73d","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/9/commits","review_comments_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/9/comments","review_comment_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/issues/9/comments","statuses_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/statuses/09a6a691a4ef9ce0a38df8020565d50a07704436","head":{"label":"MrBlooKangaroo:review-form-api","ref":"review-form-api","sha":"09a6a691a4ef9ce0a38df8020565d50a07704436","user":{"login":"MrBlooKangaroo","id":43078660,"node_id":"MDQ6VXNlcjQzMDc4NjYw","avatar_url":"https://avatars1.githubusercontent.com/u/43078660?v=4","gravatar_id":"","url":"https://api.github.com/users/MrBlooKangaroo","html_url":"https://github.com/MrBlooKangaroo","followers_url":"https://api.github.com/users/MrBlooKangaroo/followers","following_url":"https://api.github.com/users/MrBlooKangaroo/following{/other_user}","gists_url":"https://api.github.com/users/MrBlooKangaroo/gists{/gist_id}","starred_url":"https://api.github.com/users/MrBlooKangaroo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrBlooKangaroo/subscriptions","organizations_url":"https://api.github.com/users/MrBlooKangaroo/orgs","repos_url":"https://api.github.com/users/MrBlooKangaroo/repos","events_url":"https://api.github.com/users/MrBlooKangaroo/events{/privacy}","received_events_url":"https://api.github.com/users/MrBlooKangaroo/received_events","type":"User","site_admin":false},"repo":{"id":153159725,"node_id":"MDEwOlJlcG9zaXRvcnkxNTMxNTk3MjU=","name":"muralis","full_name":"MrBlooKangaroo/muralis","private":false,"owner":{"login":"MrBlooKangaroo","id":43078660,"node_id":"MDQ6VXNlcjQzMDc4NjYw","avatar_url":"https://avatars1.githubusercontent.com/u/43078660?v=4","gravatar_id":"","url":"https://api.github.com/users/MrBlooKangaroo","html_url":"https://github.com/MrBlooKangaroo","followers_url":"https://api.github.com/users/MrBlooKangaroo/followers","following_url":"https://api.github.com/users/MrBlooKangaroo/following{/other_user}","gists_url":"https://api.github.com/users/MrBlooKangaroo/gists{/gist_id}","starred_url":"https://api.github.com/users/MrBlooKangaroo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrBlooKangaroo/subscriptions","organizations_url":"https://api.github.com/users/MrBlooKangaroo/orgs","repos_url":"https://api.github.com/users/MrBlooKangaroo/repos","events_url":"https://api.github.com/users/MrBlooKangaroo/events{/privacy}","received_events_url":"https://api.github.com/users/MrBlooKangaroo/received_events","type":"User","site_admin":false},"html_url":"https://github.com/MrBlooKangaroo/muralis","description":"the definitive platform for cataloguing and reviewing urban art and public graffiti pieces","fork":false,"url":"https://api.github.com/repos/MrBlooKangaroo/muralis","forks_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/forks","keys_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/teams","hooks_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/hooks","issue_events_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/issues/events{/number}","events_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/events","assignees_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/assignees{/user}","branches_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/branches{/branch}","tags_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/tags","blobs_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/git/refs{/sha}","trees_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/statuses/{sha}","languages_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/languages","stargazers_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/stargazers","contributors_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/contributors","subscribers_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/subscribers","subscription_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/subscription","commits_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/commits{/sha}","git_commits_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/git/commits{/sha}","comments_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/comments{/number}","issue_comment_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/issues/comments{/number}","contents_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/contents/{+path}","compare_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/merges","archive_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/downloads","issues_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/issues{/number}","pulls_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls{/number}","milestones_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/milestones{/number}","notifications_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/labels{/name}","releases_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/releases{/id}","deployments_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/deployments","created_at":"2018-10-15T18:08:30Z","updated_at":"2018-10-24T19:13:10Z","pushed_at":"2018-10-25T14:58:51Z","git_url":"git://github.com/MrBlooKangaroo/muralis.git","ssh_url":"git@github.com:MrBlooKangaroo/muralis.git","clone_url":"https://github.com/MrBlooKangaroo/muralis.git","svn_url":"https://github.com/MrBlooKangaroo/muralis","homepage":null,"size":22620,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"MrBlooKangaroo:master","ref":"master","sha":"22d119ba1bcec916de77ec22eed19db6f500c52b","user":{"login":"MrBlooKangaroo","id":43078660,"node_id":"MDQ6VXNlcjQzMDc4NjYw","avatar_url":"https://avatars1.githubusercontent.com/u/43078660?v=4","gravatar_id":"","url":"https://api.github.com/users/MrBlooKangaroo","html_url":"https://github.com/MrBlooKangaroo","followers_url":"https://api.github.com/users/MrBlooKangaroo/followers","following_url":"https://api.github.com/users/MrBlooKangaroo/following{/other_user}","gists_url":"https://api.github.com/users/MrBlooKangaroo/gists{/gist_id}","starred_url":"https://api.github.com/users/MrBlooKangaroo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrBlooKangaroo/subscriptions","organizations_url":"https://api.github.com/users/MrBlooKangaroo/orgs","repos_url":"https://api.github.com/users/MrBlooKangaroo/repos","events_url":"https://api.github.com/users/MrBlooKangaroo/events{/privacy}","received_events_url":"https://api.github.com/users/MrBlooKangaroo/received_events","type":"User","site_admin":false},"repo":{"id":153159725,"node_id":"MDEwOlJlcG9zaXRvcnkxNTMxNTk3MjU=","name":"muralis","full_name":"MrBlooKangaroo/muralis","private":false,"owner":{"login":"MrBlooKangaroo","id":43078660,"node_id":"MDQ6VXNlcjQzMDc4NjYw","avatar_url":"https://avatars1.githubusercontent.com/u/43078660?v=4","gravatar_id":"","url":"https://api.github.com/users/MrBlooKangaroo","html_url":"https://github.com/MrBlooKangaroo","followers_url":"https://api.github.com/users/MrBlooKangaroo/followers","following_url":"https://api.github.com/users/MrBlooKangaroo/following{/other_user}","gists_url":"https://api.github.com/users/MrBlooKangaroo/gists{/gist_id}","starred_url":"https://api.github.com/users/MrBlooKangaroo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MrBlooKangaroo/subscriptions","organizations_url":"https://api.github.com/users/MrBlooKangaroo/orgs","repos_url":"https://api.github.com/users/MrBlooKangaroo/repos","events_url":"https://api.github.com/users/MrBlooKangaroo/events{/privacy}","received_events_url":"https://api.github.com/users/MrBlooKangaroo/received_events","type":"User","site_admin":false},"html_url":"https://github.com/MrBlooKangaroo/muralis","description":"the definitive platform for cataloguing and reviewing urban art and public graffiti pieces","fork":false,"url":"https://api.github.com/repos/MrBlooKangaroo/muralis","forks_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/forks","keys_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/teams","hooks_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/hooks","issue_events_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/issues/events{/number}","events_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/events","assignees_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/assignees{/user}","branches_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/branches{/branch}","tags_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/tags","blobs_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/git/refs{/sha}","trees_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/statuses/{sha}","languages_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/languages","stargazers_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/stargazers","contributors_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/contributors","subscribers_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/subscribers","subscription_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/subscription","commits_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/commits{/sha}","git_commits_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/git/commits{/sha}","comments_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/comments{/number}","issue_comment_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/issues/comments{/number}","contents_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/contents/{+path}","compare_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/merges","archive_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/downloads","issues_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/issues{/number}","pulls_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls{/number}","milestones_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/milestones{/number}","notifications_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/labels{/name}","releases_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/releases{/id}","deployments_url":"https://api.github.com/repos/MrBlooKangaroo/muralis/deployments","created_at":"2018-10-15T18:08:30Z","updated_at":"2018-10-24T19:13:10Z","pushed_at":"2018-10-25T14:58:51Z","git_url":"git://github.com/MrBlooKangaroo/muralis.git","ssh_url":"git@github.com:MrBlooKangaroo/muralis.git","clone_url":"https://github.com/MrBlooKangaroo/muralis.git","svn_url":"https://github.com/MrBlooKangaroo/muralis","homepage":null,"size":22620,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/9"},"html":{"href":"https://github.com/MrBlooKangaroo/muralis/pull/9"},"issue":{"href":"https://api.github.com/repos/MrBlooKangaroo/muralis/issues/9"},"comments":{"href":"https://api.github.com/repos/MrBlooKangaroo/muralis/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MrBlooKangaroo/muralis/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/MrBlooKangaroo/muralis/statuses/09a6a691a4ef9ce0a38df8020565d50a07704436"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"nwalberts"}}