From 3a180448215519b361bbbe277cf89d5babd3f898 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer <raphael@joindiaspora.com> Date: Sat, 13 Aug 2011 09:59:17 -0700 Subject: [PATCH] Fix infinite scroll on search... some kind of weird thing with rails responding with json even when request.format is html, with a mime type of html --- app/controllers/people_controller.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb index 95aabbf1b9..0277fa88f3 100644 --- a/app/controllers/people_controller.rb +++ b/app/controllers/people_controller.rb @@ -30,7 +30,18 @@ class PeopleController < ApplicationController render :json => @people end - format.all do + format.html do + #only do it if it is an email address + if params[:q].try(:match, Devise.email_regexp) + people = Person.where(:diaspora_handle => params[:q]) + webfinger(params[:q]) if people.empty? + else + people = Person.search(params[:q], current_user) + end + @people = people.paginate( :page => params[:page], :per_page => 15) + @hashes = hashes_for_people(@people, @aspects) + end + format.mobile do #only do it if it is an email address if params[:q].try(:match, Devise.email_regexp) people = Person.where(:diaspora_handle => params[:q]) @@ -68,7 +79,7 @@ class PeopleController < ApplicationController @person = Person.find_from_id_or_username(params) if remote_profile_with_no_user_session? - raise ActiveRecord::RecordNotFound + raise ActiveRecord::RecordNotFound end @post_type = :all -- GitLab