Remove special-case for diaspora-handle lookups in people controller.
Thss partly reverts a475d5fb62. The special case here was only ever used for the chat, which no longer exists.
This commit is contained in:
parent
4c46ca1a94
commit
0810fa77e9
2 changed files with 4 additions and 20 deletions
|
|
@ -126,16 +126,10 @@ class PeopleController < ApplicationController
|
||||||
|
|
||||||
def find_person
|
def find_person
|
||||||
username = params[:username]
|
username = params[:username]
|
||||||
@person = if diaspora_id?(username)
|
@person = Person.find_from_guid_or_username(
|
||||||
Person.where({
|
id: params[:id] || params[:person_id],
|
||||||
diaspora_handle: username.downcase
|
username: username
|
||||||
}).first
|
)
|
||||||
else
|
|
||||||
Person.find_from_guid_or_username({
|
|
||||||
id: params[:id] || params[:person_id],
|
|
||||||
username: username
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
raise ActiveRecord::RecordNotFound if @person.nil?
|
raise ActiveRecord::RecordNotFound if @person.nil?
|
||||||
raise Diaspora::AccountClosed if @person.closed_account?
|
raise Diaspora::AccountClosed if @person.closed_account?
|
||||||
|
|
|
||||||
|
|
@ -206,16 +206,6 @@ describe PeopleController, type: :controller do
|
||||||
expect(assigns(:presenter).to_json).to eq(@presenter.to_json)
|
expect(assigns(:presenter).to_json).to eq(@presenter.to_json)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "404s if no person is found via diaspora handle" do
|
|
||||||
get :show, params: {username: "delicious@pod.net"}
|
|
||||||
expect(response.code).to eq("404")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "finds a person via diaspora handle" do
|
|
||||||
get :show, params: {username: @person.diaspora_handle}
|
|
||||||
expect(assigns(:presenter).to_json).to eq(@presenter.to_json)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "redirects home for closed account" do
|
it "redirects home for closed account" do
|
||||||
@person = FactoryBot.create(:person, closed_account: true)
|
@person = FactoryBot.create(:person, closed_account: true)
|
||||||
get :show, params: {id: @person.to_param}
|
get :show, params: {id: @person.to_param}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue