Loading app/controllers/likes_controller.rb +3 −7 Original line number Diff line number Diff line Loading @@ -31,13 +31,9 @@ class LikesController < ApplicationController end def index @likes = like_service.find_for_post(params[:post_id]).includes(author: :profile) @people = @likes.map(&:author) respond_to do |format| format.all { render :layout => false } format.json { render :json => @likes.as_api_response(:backbone) } end render json: like_service.find_for_post(params[:post_id]) .includes(author: :profile) .as_api_response(:backbone) end private Loading app/views/likes/_likes.hamldeleted 100644 → 0 +0 −6 Original line number Diff line number Diff line -# Copyright (c) 2010-2011, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - @people[0..17].each do |person| = person_image_link(person, size: :thumb_small) app/views/likes/index.html.hamldeleted 100644 → 0 +0 −1 Original line number Diff line number Diff line = render 'likes', :likes => @likes spec/controllers/likes_controller_spec.rb +2 −2 Original line number Diff line number Diff line Loading @@ -87,12 +87,12 @@ describe LikesController, type: :controller do it "returns an array of likes for a post" do bob.like!(@message) get :index, post_id: @message.id expect(assigns[:likes].map(&:id)).to eq(@message.likes.map(&:id)) expect(JSON.parse(response.body).map {|h| h["id"] }).to match_array(@message.likes.map(&:id)) end it "returns an empty array for a post with no likes" do get :index, post_id: @message.id expect(assigns[:likes]).to eq([]) expect(JSON.parse(response.body).map(&:id)).to eq([]) end end Loading Loading
app/controllers/likes_controller.rb +3 −7 Original line number Diff line number Diff line Loading @@ -31,13 +31,9 @@ class LikesController < ApplicationController end def index @likes = like_service.find_for_post(params[:post_id]).includes(author: :profile) @people = @likes.map(&:author) respond_to do |format| format.all { render :layout => false } format.json { render :json => @likes.as_api_response(:backbone) } end render json: like_service.find_for_post(params[:post_id]) .includes(author: :profile) .as_api_response(:backbone) end private Loading
app/views/likes/_likes.hamldeleted 100644 → 0 +0 −6 Original line number Diff line number Diff line -# Copyright (c) 2010-2011, Diaspora Inc. This file is -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. - @people[0..17].each do |person| = person_image_link(person, size: :thumb_small)
app/views/likes/index.html.hamldeleted 100644 → 0 +0 −1 Original line number Diff line number Diff line = render 'likes', :likes => @likes
spec/controllers/likes_controller_spec.rb +2 −2 Original line number Diff line number Diff line Loading @@ -87,12 +87,12 @@ describe LikesController, type: :controller do it "returns an array of likes for a post" do bob.like!(@message) get :index, post_id: @message.id expect(assigns[:likes].map(&:id)).to eq(@message.likes.map(&:id)) expect(JSON.parse(response.body).map {|h| h["id"] }).to match_array(@message.likes.map(&:id)) end it "returns an empty array for a post with no likes" do get :index, post_id: @message.id expect(assigns[:likes]).to eq([]) expect(JSON.parse(response.body).map(&:id)).to eq([]) end end Loading