Skip to content
Extraits de code Groupes Projets
Valider b21b0adc rédigé par maxwell's avatar maxwell
Parcourir les fichiers

remove single user redirect

parent c6a3cff6
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -12,15 +12,11 @@ class PeopleController < ApplicationController ...@@ -12,15 +12,11 @@ class PeopleController < ApplicationController
@aspect = :search @aspect = :search
@people = Person.search(params[:q], current_user).paginate :page => params[:page], :per_page => 15 @people = Person.search(params[:q], current_user).paginate :page => params[:page], :per_page => 15
if @people.count == 1 @hashes = hashes_for_people(@people, @aspects)
redirect_to @people.first @people
else #only do it if it is an email address
@hashes = hashes_for_people(@people, @aspects) if params[:q].try(:match, Devise.email_regexp)
@people webfinger(params[:q])
#only do it if it is an email address
if params[:q].try(:match, Devise.email_regexp)
webfinger(params[:q])
end
end end
end end
......
...@@ -75,7 +75,7 @@ describe PeopleController do ...@@ -75,7 +75,7 @@ describe PeopleController do
response.should be_success response.should be_success
end end
end end
describe '#index' do describe '#index (search)' do
before do before do
@eugene = Factory.create(:person, @eugene = Factory.create(:person,
:profile => Factory(:profile, :first_name => "Eugene", :profile => Factory(:profile, :first_name => "Eugene",
...@@ -89,26 +89,13 @@ describe PeopleController do ...@@ -89,26 +89,13 @@ describe PeopleController do
eugene2 = Factory.create(:person, eugene2 = Factory.create(:person,
:profile => Factory(:profile, :first_name => "Eugene", :profile => Factory(:profile, :first_name => "Eugene",
:last_name => "w")) :last_name => "w"))
get :index, :q => "Eu" get :index, :q => "Eug"
assigns[:people].should =~ [@eugene, eugene2] assigns[:people].should =~ [@eugene, eugene2]
end 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" get :index, :q => "Korth"
response.should redirect_to @korth response.should_not redirect_to @korth
end end
it "does not redirect if there are no matches" do it "does not redirect if there are no matches" do
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter