diff --git a/app/controllers/sockets_controller.rb b/app/controllers/sockets_controller.rb index 80d369c3c..ab76f25ba 100644 --- a/app/controllers/sockets_controller.rb +++ b/app/controllers/sockets_controller.rb @@ -8,6 +8,7 @@ class SocketsController < ApplicationController include Rails.application.routes.url_helpers helper_method :all_aspects helper_method :current_user + helper_method 'all_comments?' def incoming(msg) Rails.logger.info("Socket received connection to: #{msg}") @@ -45,6 +46,11 @@ class SocketsController < ApplicationController @all_aspects ||= user.aspects end + # Override of CommentsHelper#all_comments? . + def all_comments? + false + end + class SocketRequest < ActionDispatch::Request def format 'socket' diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb index 492b38eae..c4e96ee40 100644 --- a/app/helpers/comments_helper.rb +++ b/app/helpers/comments_helper.rb @@ -44,6 +44,6 @@ module CommentsHelper end def all_comments? - defined?(request_parameters) && !! params['all_comments'] + !! params['all_comments'] end end diff --git a/spec/controllers/posts_controller_spec.rb b/spec/controllers/posts_controller_spec.rb index c2c97099d..1db8282e8 100644 --- a/spec/controllers/posts_controller_spec.rb +++ b/spec/controllers/posts_controller_spec.rb @@ -76,6 +76,26 @@ describe PostsController do response.body.should == @status.to_diaspora_xml end + context 'with more than 3 comments' do + before do + (1..5).each do |i| + alice.comment "comment #{i}", :post => @status + end + end + + it 'shows all comments of a public post' do + get :show, :id => @status.id + + response.body.should =~ /comment 3/ + response.body.should_not =~ /comment 2/ + + get :show, :id => @status.id, 'all_comments' => '1' + + response.body.should =~ /comment 3/ + response.body.should =~ /comment 2/ + end + end + end it 'shows a public photo' do