Query on guid, not id

This commit is contained in:
Raphael 2011-01-18 16:07:58 -08:00
parent 9e5cf1e1a4
commit 85bae12a00
2 changed files with 5 additions and 5 deletions

View file

@ -15,7 +15,7 @@ class PublicsController < ApplicationController
caches_page :host_meta
def hcard
@person = Person.find_by_id params[:id]
@person = Person.where(:guid => params[:guid])
unless @person.nil? || @person.owner.nil?
render 'publics/hcard'
else
@ -48,10 +48,10 @@ class PublicsController < ApplicationController
return
end
person = Person.find(params[:id])
person = Person.where(:guid => params[:guid]).first
if person.owner_id.nil?
Rails.logger.error("Received post for nonexistent person #{params[:id]}")
Rails.logger.error("Received post for nonexistent person #{params[:guid]}")
render :nothing => true, :status => 404
return
end

View file

@ -45,9 +45,9 @@ Diaspora::Application.routes.draw do
#public routes
match 'webfinger', :to => 'publics#webfinger'
match 'hcard/users/:id', :to => 'publics#hcard'
match 'hcard/users/:guid', :to => 'publics#hcard'
match '.well-known/host-meta',:to => 'publics#host_meta'
match 'receive/users/:id', :to => 'publics#receive'
match 'receive/users/:guid', :to => 'publics#receive'
match 'hub', :to => 'publics#hub'
#root