From b21b0adca7463dfc1f3723cfd8da96d69f9920bd Mon Sep 17 00:00:00 2001
From: maxwell <maxwell@joindiaspora.com>
Date: Thu, 20 Jan 2011 15:02:46 -0800
Subject: [PATCH] remove single user redirect

---
 app/controllers/people_controller.rb       | 14 +++++---------
 spec/controllers/people_controller_spec.rb | 21 ++++-----------------
 2 files changed, 9 insertions(+), 26 deletions(-)

diff --git a/app/controllers/people_controller.rb b/app/controllers/people_controller.rb
index 0f0dbe5ed2..e9640cac1d 100644
--- a/app/controllers/people_controller.rb
+++ b/app/controllers/people_controller.rb
@@ -12,15 +12,11 @@ class PeopleController < ApplicationController
     @aspect = :search
 
     @people = Person.search(params[:q], current_user).paginate :page => params[:page], :per_page => 15
-    if @people.count == 1
-      redirect_to @people.first
-    else
-      @hashes = hashes_for_people(@people, @aspects)
-      @people
-      #only do it if it is an email address
-      if params[:q].try(:match, Devise.email_regexp)
-        webfinger(params[:q])
-      end
+    @hashes = hashes_for_people(@people, @aspects)
+    @people
+    #only do it if it is an email address
+    if params[:q].try(:match, Devise.email_regexp)
+      webfinger(params[:q])
     end
   end
 
diff --git a/spec/controllers/people_controller_spec.rb b/spec/controllers/people_controller_spec.rb
index f6a4ef56d5..ebd99fcde2 100644
--- a/spec/controllers/people_controller_spec.rb
+++ b/spec/controllers/people_controller_spec.rb
@@ -75,7 +75,7 @@ describe PeopleController do
       response.should be_success
     end
   end
-  describe '#index' do
+  describe '#index (search)' do
     before do
       @eugene = Factory.create(:person,
         :profile => Factory(:profile, :first_name => "Eugene",
@@ -89,26 +89,13 @@ describe PeopleController do
       eugene2 = Factory.create(:person,
         :profile => Factory(:profile, :first_name => "Eugene",
                      :last_name => "w"))
-      get :index, :q => "Eu"
+      get :index, :q => "Eug"
       assigns[:people].should =~ [@eugene, eugene2]
     end
-    it 'shows a contact' do
-      user2 = bob
-      get :index, :q => user2.person.profile.first_name.to_s
-      response.should redirect_to user2.person
-    end
-
-    it 'shows a non-contact' do
-      user2 = eve
-      user2.person.profile.searchable = true
-      user2.save
-      get :index, :q => user2.person.profile.first_name.to_s
-      response.should redirect_to user2.person
-    end
 
-    it "redirects to person page if there is exactly one match" do
+    it "does not redirect to person page if there is exactly one match" do
       get :index, :q => "Korth"
-      response.should redirect_to @korth
+      response.should_not redirect_to @korth
     end
 
     it "does not redirect if there are no matches" do
-- 
GitLab