fix /u/[username] route

This commit is contained in:
Florian Staudacher 2014-09-17 21:39:04 +02:00
parent 0bbf304e03
commit 6e1bd7216d
2 changed files with 9 additions and 2 deletions

View file

@ -174,8 +174,10 @@ class PeopleController < ApplicationController
private
def find_person
person_id = params[:id] || params[:person_id]
@person = Person.find_from_guid_or_username({id: person_id})
@person = Person.find_from_guid_or_username({
id: params[:id] || params[:person_id],
username: params[:username]
})
# view this profile on the home pod, if you don't want to sign in...
authenticate_user! if remote_profile_with_no_user_session?

View file

@ -174,6 +174,11 @@ describe PeopleController, :type => :controller do
expect(response.code).to eq("404")
end
it 'finds a person via username' do
get :show, username: @user.username
expect(assigns(:person)).to eq(@user.person)
end
it 'redirects home for closed account' do
@person = FactoryGirl.create(:person, :closed_account => true)
get :show, :id => @person.to_param