special-casing local webfinger
This commit is contained in:
parent
6ae4c31e05
commit
4c731bf818
3 changed files with 16 additions and 5 deletions
|
|
@ -15,7 +15,7 @@ class PublicsController < ApplicationController
|
|||
end
|
||||
|
||||
def webfinger
|
||||
@person = Person.first(:email => params[:q].gsub('acct:', ''))
|
||||
@person = Person.by_webfinger(params[:q])
|
||||
unless @person.nil? || @person.owner.nil?
|
||||
render 'webfinger', :layout => false, :content_type => 'application/xrd+xml'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -26,9 +26,16 @@ module RequestsHelper
|
|||
end
|
||||
|
||||
def relationship_flow(identifier)
|
||||
f = Redfinger.finger(identifier)
|
||||
action = subscription_mode(f)
|
||||
url = subscription_url(action, f)
|
||||
puts request.host
|
||||
if identifier.include?(request.host)
|
||||
person = Person.by_webfinger identifier
|
||||
action = :friend
|
||||
url = person.owner.receive_url
|
||||
else
|
||||
f = Redfinger.finger(identifier)
|
||||
action = subscription_mode(f)
|
||||
url = subscription_url(action, f)
|
||||
end
|
||||
{ action => url }
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class Person
|
|||
false
|
||||
end
|
||||
|
||||
def send_comment c
|
||||
def send_comment( c )
|
||||
if self.owner.nil?
|
||||
if c.post.person.owner.nil?
|
||||
#puts "The commenter is not here, and neither is the poster"
|
||||
|
|
@ -112,6 +112,10 @@ class Person
|
|||
"#{self.url}receive/users/#{self.id}/"
|
||||
end
|
||||
|
||||
def self.by_webfinger( identifier )
|
||||
Person.first(:email => identifier.gsub('acct:', ''))
|
||||
end
|
||||
|
||||
protected
|
||||
def clean_url
|
||||
self.url ||= "http://localhost:3000/" if self.class == User
|
||||
|
|
|
|||
Loading…
Reference in a new issue