{"action":"created","comment":{"url":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/comments/33895859","id":33895859,"diff_hunk":"@@ -0,0 +1,107 @@\n+require 'sinatra'\n+require 'sinatra/base'\n+require 'sinatra/flash'\n+require './app/data_mapper_setup'\n+\n+class Chitter < Sinatra::Base\n+\n+  enable :sessions\n+  register Sinatra::Flash\n+\n+  get '/' do\n+    if current_user\n+      redirect '/sessions/new'\n+    else\n+      erb :'users/sign_up'\n+    end\n+  end\n+\n+  get '/:username' do\n+    @user = User.first(username: params[:username])\n+    if @user\n+      @peeps = @user.peeps.all(:order => :time_stamp.desc )\n+      all_users_peep_ids = @peeps.map{ |peep| peep.id }\n+      replies = Peep.all(reply: true)\n+      @users_replies = replies.select{ |peep| all_users_peep_ids.include?(peep.replied_id) }\n+      erb :'sessions/peeps'\n+    else\n+      erb :'users/not_found'\n+    end\n+  end\n+\n+  post '/:username' do\n+    @user = User.first(username: params[:username])\n+    peep = Peep.create(text: params[:reply], time_stamp: Time.now, user_id: current_user.id, reply: true, replied_id: params[:peep_id])\n+    current_user.peeps << peep\n+    @peeps = @user.peeps.all(:order => :time_stamp.desc )\n+    all_users_peep_ids = @peeps.map{ |peep| peep.id }\n+    replies = Peep.all(reply: true)\n+    @users_replies = replies.select{ |peep| all_users_peep_ids.include?(peep.replied_id) }\n+    erb :'sessions/peeps'\n+  end\n+\n+  post '/users/new' do\n+    @user = User.new(username: params[:username], name: params[:name], email: params[:email], password: params[:password])\n+    if @user.save\n+      session[:user_id] = @user.id\n+      erb :'users/new'\n+    else\n+      flash[:errors] = @user.errors.full_messages\n+      redirect '/'\n+    end\n+  end\n+\n+  post '/sessions/new' do\n+    if User.first(username: params[:username])\n+      @user = User.authenticate(username: params[:username], password: params[:password])\n+      if @user\n+        session[:user_id] = @user.id unless session[:user_id]\n+        @peeps = current_user.peeps.all(:order => :time_stamp.desc )\n+        all_users_peep_ids = @peeps.map{ |peep| peep.id }\n+        replies = Peep.all(reply: true)\n+        @users_replies = replies.select{ |peep| all_users_peep_ids.include?(peep.replied_id) }\n+        erb :'sessions/peeps'\n+      else\n+        flash[:errors] = ['Incorrect password']\n+        redirect '/'\n+      end\n+    else\n+      flash[:errors] = ['No username exists, try signing up']\n+      redirect '/'\n+    end\n+  end\n+\n+  get '/sessions/new' do\n+    @user = current_user\n+    @peeps = current_user.peeps.all(:order => :time_stamp.desc )\n+    all_users_peep_ids = @peeps.map{ |peep| peep.id }","path":"app/app.rb","position":77,"original_position":77,"commit_id":"4bca9931a8569685c4c41bd64437d46040b568d0","original_commit_id":"4bca9931a8569685c4c41bd64437d46040b568d0","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":"Space missing to the left of {.<br>Pass `&:id` as an argument to `map` instead of a block.","created_at":"2015-07-05T15:46:55Z","updated_at":"2015-07-05T15:46:55Z","html_url":"https://github.com/makersacademy/chitter-challenge/pull/74#discussion_r33895859","pull_request_url":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/74","_links":{"self":{"href":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/comments/33895859"},"html":{"href":"https://github.com/makersacademy/chitter-challenge/pull/74#discussion_r33895859"},"pull_request":{"href":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/74"}}},"pull_request":{"url":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/74","id":39220450,"html_url":"https://github.com/makersacademy/chitter-challenge/pull/74","diff_url":"https://github.com/makersacademy/chitter-challenge/pull/74.diff","patch_url":"https://github.com/makersacademy/chitter-challenge/pull/74.patch","issue_url":"https://api.github.com/repos/makersacademy/chitter-challenge/issues/74","number":74,"state":"open","locked":false,"title":"Nicola Hughes Week 4 Challenge submit","user":{"login":"DataMinerUK","id":1016646,"avatar_url":"https://avatars.githubusercontent.com/u/1016646?v=3","gravatar_id":"","url":"https://api.github.com/users/DataMinerUK","html_url":"https://github.com/DataMinerUK","followers_url":"https://api.github.com/users/DataMinerUK/followers","following_url":"https://api.github.com/users/DataMinerUK/following{/other_user}","gists_url":"https://api.github.com/users/DataMinerUK/gists{/gist_id}","starred_url":"https://api.github.com/users/DataMinerUK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataMinerUK/subscriptions","organizations_url":"https://api.github.com/users/DataMinerUK/orgs","repos_url":"https://api.github.com/users/DataMinerUK/repos","events_url":"https://api.github.com/users/DataMinerUK/events{/privacy}","received_events_url":"https://api.github.com/users/DataMinerUK/received_events","type":"User","site_admin":false},"body":"Difficulties: \r\n\r\n- The method used to create a delete http request did not work for me and I could not figure out why.\r\n- Once I allowed non-logged in users to view chitters profile pages the user journeys got very complicated. I was wondering if there was a way to better organise for this in tests\r\n- In deciding what I needed to cover in the tests","created_at":"2015-07-05T12:55:40Z","updated_at":"2015-07-05T15:46:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f7637623c92c8b86a4f71bc0c6b3df6581755a18","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/74/commits","review_comments_url":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/74/comments","review_comment_url":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/comments{/number}","comments_url":"https://api.github.com/repos/makersacademy/chitter-challenge/issues/74/comments","statuses_url":"https://api.github.com/repos/makersacademy/chitter-challenge/statuses/4bca9931a8569685c4c41bd64437d46040b568d0","head":{"label":"DataMinerUK:master","ref":"master","sha":"4bca9931a8569685c4c41bd64437d46040b568d0","user":{"login":"DataMinerUK","id":1016646,"avatar_url":"https://avatars.githubusercontent.com/u/1016646?v=3","gravatar_id":"","url":"https://api.github.com/users/DataMinerUK","html_url":"https://github.com/DataMinerUK","followers_url":"https://api.github.com/users/DataMinerUK/followers","following_url":"https://api.github.com/users/DataMinerUK/following{/other_user}","gists_url":"https://api.github.com/users/DataMinerUK/gists{/gist_id}","starred_url":"https://api.github.com/users/DataMinerUK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataMinerUK/subscriptions","organizations_url":"https://api.github.com/users/DataMinerUK/orgs","repos_url":"https://api.github.com/users/DataMinerUK/repos","events_url":"https://api.github.com/users/DataMinerUK/events{/privacy}","received_events_url":"https://api.github.com/users/DataMinerUK/received_events","type":"User","site_admin":false},"repo":{"id":38488406,"name":"chitter-challenge","full_name":"DataMinerUK/chitter-challenge","owner":{"login":"DataMinerUK","id":1016646,"avatar_url":"https://avatars.githubusercontent.com/u/1016646?v=3","gravatar_id":"","url":"https://api.github.com/users/DataMinerUK","html_url":"https://github.com/DataMinerUK","followers_url":"https://api.github.com/users/DataMinerUK/followers","following_url":"https://api.github.com/users/DataMinerUK/following{/other_user}","gists_url":"https://api.github.com/users/DataMinerUK/gists{/gist_id}","starred_url":"https://api.github.com/users/DataMinerUK/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DataMinerUK/subscriptions","organizations_url":"https://api.github.com/users/DataMinerUK/orgs","repos_url":"https://api.github.com/users/DataMinerUK/repos","events_url":"https://api.github.com/users/DataMinerUK/events{/privacy}","received_events_url":"https://api.github.com/users/DataMinerUK/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/DataMinerUK/chitter-challenge","description":"Build a Twitter Clone!","fork":true,"url":"https://api.github.com/repos/DataMinerUK/chitter-challenge","forks_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/forks","keys_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/teams","hooks_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/hooks","issue_events_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/issues/events{/number}","events_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/events","assignees_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/assignees{/user}","branches_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/branches{/branch}","tags_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/tags","blobs_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/git/refs{/sha}","trees_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/statuses/{sha}","languages_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/languages","stargazers_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/stargazers","contributors_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/contributors","subscribers_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/subscribers","subscription_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/subscription","commits_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/commits{/sha}","git_commits_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/git/commits{/sha}","comments_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/comments{/number}","issue_comment_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/issues/comments{/number}","contents_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/contents/{+path}","compare_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/merges","archive_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/downloads","issues_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/issues{/number}","pulls_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/pulls{/number}","milestones_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/milestones{/number}","notifications_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/labels{/name}","releases_url":"https://api.github.com/repos/DataMinerUK/chitter-challenge/releases{/id}","created_at":"2015-07-03T11:00:02Z","updated_at":"2015-07-03T11:00:03Z","pushed_at":"2015-07-05T15:46:50Z","git_url":"git://github.com/DataMinerUK/chitter-challenge.git","ssh_url":"git@github.com:DataMinerUK/chitter-challenge.git","clone_url":"https://github.com/DataMinerUK/chitter-challenge.git","svn_url":"https://github.com/DataMinerUK/chitter-challenge","homepage":null,"size":155,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"makersacademy:master","ref":"master","sha":"e5089a84bb003abe0af9486b5270dcd2f8d1b964","user":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars.githubusercontent.com/u/3636186?v=3","gravatar_id":"","url":"https://api.github.com/users/makersacademy","html_url":"https://github.com/makersacademy","followers_url":"https://api.github.com/users/makersacademy/followers","following_url":"https://api.github.com/users/makersacademy/following{/other_user}","gists_url":"https://api.github.com/users/makersacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/makersacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makersacademy/subscriptions","organizations_url":"https://api.github.com/users/makersacademy/orgs","repos_url":"https://api.github.com/users/makersacademy/repos","events_url":"https://api.github.com/users/makersacademy/events{/privacy}","received_events_url":"https://api.github.com/users/makersacademy/received_events","type":"Organization","site_admin":false},"repo":{"id":26954706,"name":"chitter-challenge","full_name":"makersacademy/chitter-challenge","owner":{"login":"makersacademy","id":3636186,"avatar_url":"https://avatars.githubusercontent.com/u/3636186?v=3","gravatar_id":"","url":"https://api.github.com/users/makersacademy","html_url":"https://github.com/makersacademy","followers_url":"https://api.github.com/users/makersacademy/followers","following_url":"https://api.github.com/users/makersacademy/following{/other_user}","gists_url":"https://api.github.com/users/makersacademy/gists{/gist_id}","starred_url":"https://api.github.com/users/makersacademy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/makersacademy/subscriptions","organizations_url":"https://api.github.com/users/makersacademy/orgs","repos_url":"https://api.github.com/users/makersacademy/repos","events_url":"https://api.github.com/users/makersacademy/events{/privacy}","received_events_url":"https://api.github.com/users/makersacademy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/makersacademy/chitter-challenge","description":"Build a Twitter Clone!","fork":false,"url":"https://api.github.com/repos/makersacademy/chitter-challenge","forks_url":"https://api.github.com/repos/makersacademy/chitter-challenge/forks","keys_url":"https://api.github.com/repos/makersacademy/chitter-challenge/keys{/key_id}","collaborators_url":"https://api.github.com/repos/makersacademy/chitter-challenge/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/makersacademy/chitter-challenge/teams","hooks_url":"https://api.github.com/repos/makersacademy/chitter-challenge/hooks","issue_events_url":"https://api.github.com/repos/makersacademy/chitter-challenge/issues/events{/number}","events_url":"https://api.github.com/repos/makersacademy/chitter-challenge/events","assignees_url":"https://api.github.com/repos/makersacademy/chitter-challenge/assignees{/user}","branches_url":"https://api.github.com/repos/makersacademy/chitter-challenge/branches{/branch}","tags_url":"https://api.github.com/repos/makersacademy/chitter-challenge/tags","blobs_url":"https://api.github.com/repos/makersacademy/chitter-challenge/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/makersacademy/chitter-challenge/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/makersacademy/chitter-challenge/git/refs{/sha}","trees_url":"https://api.github.com/repos/makersacademy/chitter-challenge/git/trees{/sha}","statuses_url":"https://api.github.com/repos/makersacademy/chitter-challenge/statuses/{sha}","languages_url":"https://api.github.com/repos/makersacademy/chitter-challenge/languages","stargazers_url":"https://api.github.com/repos/makersacademy/chitter-challenge/stargazers","contributors_url":"https://api.github.com/repos/makersacademy/chitter-challenge/contributors","subscribers_url":"https://api.github.com/repos/makersacademy/chitter-challenge/subscribers","subscription_url":"https://api.github.com/repos/makersacademy/chitter-challenge/subscription","commits_url":"https://api.github.com/repos/makersacademy/chitter-challenge/commits{/sha}","git_commits_url":"https://api.github.com/repos/makersacademy/chitter-challenge/git/commits{/sha}","comments_url":"https://api.github.com/repos/makersacademy/chitter-challenge/comments{/number}","issue_comment_url":"https://api.github.com/repos/makersacademy/chitter-challenge/issues/comments{/number}","contents_url":"https://api.github.com/repos/makersacademy/chitter-challenge/contents/{+path}","compare_url":"https://api.github.com/repos/makersacademy/chitter-challenge/compare/{base}...{head}","merges_url":"https://api.github.com/repos/makersacademy/chitter-challenge/merges","archive_url":"https://api.github.com/repos/makersacademy/chitter-challenge/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/makersacademy/chitter-challenge/downloads","issues_url":"https://api.github.com/repos/makersacademy/chitter-challenge/issues{/number}","pulls_url":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls{/number}","milestones_url":"https://api.github.com/repos/makersacademy/chitter-challenge/milestones{/number}","notifications_url":"https://api.github.com/repos/makersacademy/chitter-challenge/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/makersacademy/chitter-challenge/labels{/name}","releases_url":"https://api.github.com/repos/makersacademy/chitter-challenge/releases{/id}","created_at":"2014-11-21T09:53:31Z","updated_at":"2015-04-10T05:48:20Z","pushed_at":"2015-07-05T15:46:50Z","git_url":"git://github.com/makersacademy/chitter-challenge.git","ssh_url":"git@github.com:makersacademy/chitter-challenge.git","clone_url":"https://github.com/makersacademy/chitter-challenge.git","svn_url":"https://github.com/makersacademy/chitter-challenge","homepage":null,"size":21766,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":96,"mirror_url":null,"open_issues_count":4,"forks":96,"open_issues":4,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/74"},"html":{"href":"https://github.com/makersacademy/chitter-challenge/pull/74"},"issue":{"href":"https://api.github.com/repos/makersacademy/chitter-challenge/issues/74"},"comments":{"href":"https://api.github.com/repos/makersacademy/chitter-challenge/issues/74/comments"},"review_comments":{"href":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/74/comments"},"review_comment":{"href":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/makersacademy/chitter-challenge/pulls/74/commits"},"statuses":{"href":"https://api.github.com/repos/makersacademy/chitter-challenge/statuses/4bca9931a8569685c4c41bd64437d46040b568d0"}}}}