From 50919ef491703d0cfe67cff3007e8946cfd01772 Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 10:37:09 -0700 Subject: [PATCH 1/2] Requesting now searches the local server by email for a matching person. --- app/helpers/requests_helper.rb | 13 +++++++------ app/models/person.rb | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/helpers/requests_helper.rb b/app/helpers/requests_helper.rb index 16a50a886..9eed63e91 100644 --- a/app/helpers/requests_helper.rb +++ b/app/helpers/requests_helper.rb @@ -26,12 +26,13 @@ module RequestsHelper end def relationship_flow(identifier) - puts request.host - if identifier.include?(request.host) - person = Person.by_webfinger identifier - action = (person == current_user.person ? :none : :friend) - url = person.owner.receive_url - else + action = :none + url = nil + local_person = Person.by_webfinger identifier + if local_person + action = (local_person == current_user.local_person ? :none : :friend) + url = local_person.receive_url + elsif !(identifier.include?(request.host) || identifier.include?("localhost")) f = Redfinger.finger(identifier) action = subscription_mode(f) url = subscription_url(action, f) diff --git a/app/models/person.rb b/app/models/person.rb index 5ce5394bd..a70d100e9 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -40,7 +40,7 @@ class Person this.profile.first_name.match(/^#{query}/i) || this.profile.last_name.match(/^#{query}/i); }") end - + def real_name "#{profile.first_name.to_s} #{profile.last_name.to_s}" end From cba0f5477c3b7591dc81df53cb9a2a465a1f3b5e Mon Sep 17 00:00:00 2001 From: Raphael Date: Tue, 17 Aug 2010 10:41:01 -0700 Subject: [PATCH 2/2] spec for by_webfinger... after the fact --- spec/models/person_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index 44ca3c834..70f439e25 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -138,5 +138,8 @@ describe Person do people.include?(@friend_two).should == false people.include?(@friend_three).should == false end + it 'should search by email exactly' do + Person.by_webfinger(@friend_one.email).should == @friend_one + end end end