GitHub PullRequestReviewCommentEvent at 2014-03-19 23:41:35
Repository: good_or_evil
Actor: rsofaer
Payload: {"comment":{"url":"https://api.github.com/repos/wdi-sf-jan-2014/good_or_evil/pulls/comments/10777285","id":10777285,"diff_hunk":"@@ -1,13 +1,87 @@\n class PostsController < ApplicationController\n+\n+  before_action :authenticate_user!\n+\n   def index\n+    @posts = Post.order(:created_at).reverse_order.page params[:page]\n+\n+    gon.posts = @posts.map do |post|\n+      {id: post.id,\n+       good_count: post.likes.where(good:true).count,\n+       evil_count: post.likes.where(good:false).count}\n+    end\n+\n+    @post = Post.new\n   end\n \n   def new\n+    @post = current_user.posts.new\n+  end\n+\n+  def create\n+    post_params = params.require(:post).permit(:text_overlay, :photo, :photo_link)\n+    post = Post.create(post_params)\n+\n+    if post.text_overlay.nil?\n+      post.update_attributes(text_overlay: \"\")\n+    end\n+\n+    if post.photo.file.nil?\n+      BlankWorker.perform_async(post.id)\n+      redirect_to posts_path\n+    else\n+      ImageWorker.perform_async(post.id)\n+      current_user.posts << post # adding posts to current_user\n+      redirect_to posts_path\n+    end\n   end\n \n   def show\n+    @user = current_user\n+\n   end\n \n+  def create_comment\n+    comment_params = params.require(:comment).permit(:body, :post_id)\n+    @comment = Comment.create(comment_params)\n+    current_user.comments << @comment  # adding comments to current_user\n+    post = Post.find(comment_params[\"post_id\"])\n+    respond_to do |f|\n+      f.json { render :json => @comment, only: [:id, :body, :post_id]}\n+    end\n+\n+  end\n+\n+  def like\n+    like_params = params.require(:like).permit(:good, :likeable_id, :likeable_type)","path":"app/controllers/posts_controller.rb","position":56,"original_position":56,"commit_id":"3038ee5d5f2273025d4f4735a7c57ce9c4cee25c","original_commit_id":"3038ee5d5f2273025d4f4735a7c57ce9c4cee25c","user":{"login":"rsofaer","id":212750,"avatar_url":"https://avatars.githubusercontent.com/u/212750?","gravatar_id":null,"url":"https://api.github.com/users/rsofaer","html_url":"https://github.com/rsofaer","followers_url":"https://api.github.com/users/rsofaer/followers","following_url":"https://api.github.com/users/rsofaer/following{/other_user}","gists_url":"https://api.github.com/users/rsofaer/gists{/gist_id}","starred_url":"https://api.github.com/users/rsofaer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rsofaer/subscriptions","organizations_url":"https://api.github.com/users/rsofaer/orgs","repos_url":"https://api.github.com/users/rsofaer/repos","events_url":"https://api.github.com/users/rsofaer/events{/privacy}","received_events_url":"https://api.github.com/users/rsofaer/received_events","type":"User","site_admin":false},"body":"This would probably be better in LikesController#create","created_at":"2014-03-19T23:41:35Z","updated_at":"2014-03-19T23:41:35Z","html_url":"https://github.com/wdi-sf-jan-2014/good_or_evil/pull/1#discussion_r10777285","pull_request_url":"https://api.github.com/repos/wdi-sf-jan-2014/good_or_evil/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/wdi-sf-jan-2014/good_or_evil/pulls/comments/10777285"},"html":{"href":"https://github.com/wdi-sf-jan-2014/good_or_evil/pull/1#discussion_r10777285"},"pull_request":{"href":"https://api.github.com/repos/wdi-sf-jan-2014/good_or_evil/pulls/1"}}}}