diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index 368b2fe0b..a3cb40f9a 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -8,13 +8,16 @@ class ContactsController < ApplicationController def index respond_to do |format| + # Used for normal requests to contacts#index and subsequent infinite scroll calls format.html { set_up_contacts } + # Used by the mobile site format.mobile { set_up_contacts } + # Used to populate mentions in the publisher format.json { aspect_ids = params[:aspect_ids] || current_user.aspects.map(&:id) - @people = Person.all_from_aspects(aspect_ids, current_user).for_json.paginate(:page => params[:page], :per_page => 25) + @people = Person.all_from_aspects(aspect_ids, current_user).for_json render :json => @people.to_json } end diff --git a/spec/controllers/contacts_controller_spec.rb b/spec/controllers/contacts_controller_spec.rb index 8c37b3f9b..165385f81 100644 --- a/spec/controllers/contacts_controller_spec.rb +++ b/spec/controllers/contacts_controller_spec.rb @@ -28,6 +28,13 @@ describe ContactsController do end describe '#index' do + context 'format mobile' do + it "succeeds" do + get :index, :format => 'mobile' + response.should be_success + end + end + context 'format html' do it "succeeds" do get :index @@ -60,12 +67,6 @@ describe ContactsController do end context 'format json' do - it 'respects pagination' do - get :index, :format => 'json', :page => '2' - assigns[:people].should == [] - response.should be_success - end - it 'assumes all aspects if none are specified' do get :index, :format => 'json' assigns[:people].map(&:id).should =~ bob.contacts.map { |c| c.person.id }