fix /u/[username] route
This commit is contained in:
parent
0bbf304e03
commit
6e1bd7216d
2 changed files with 9 additions and 2 deletions
|
|
@ -174,8 +174,10 @@ class PeopleController < ApplicationController
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_person
|
def find_person
|
||||||
person_id = params[:id] || params[:person_id]
|
@person = Person.find_from_guid_or_username({
|
||||||
@person = Person.find_from_guid_or_username({id: person_id})
|
id: params[:id] || params[:person_id],
|
||||||
|
username: params[:username]
|
||||||
|
})
|
||||||
|
|
||||||
# view this profile on the home pod, if you don't want to sign in...
|
# view this profile on the home pod, if you don't want to sign in...
|
||||||
authenticate_user! if remote_profile_with_no_user_session?
|
authenticate_user! if remote_profile_with_no_user_session?
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,11 @@ describe PeopleController, :type => :controller do
|
||||||
expect(response.code).to eq("404")
|
expect(response.code).to eq("404")
|
||||||
end
|
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
|
it 'redirects home for closed account' do
|
||||||
@person = FactoryGirl.create(:person, :closed_account => true)
|
@person = FactoryGirl.create(:person, :closed_account => true)
|
||||||
get :show, :id => @person.to_param
|
get :show, :id => @person.to_param
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue