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:
Dennis Schubert 2021-07-04 20:35:57 +02:00 committed by Benjamin Neff
parent 4c46ca1a94
commit 0810fa77e9
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 4 additions and 20 deletions

View file

@ -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?

View file

@ -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}