MS IZ adding a friend through the webfinger profile
This commit is contained in:
parent
f34e033bce
commit
cd31d11aca
3 changed files with 21 additions and 10 deletions
|
|
@ -25,8 +25,8 @@ class RequestsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
url = find_url(params)
|
||||
@request = current_user.send_friend_request_to(params[:request][:destination_url])
|
||||
url = find_url(params[:request][:destination_url])
|
||||
@request = current_user.send_friend_request_to(url)
|
||||
if @request
|
||||
flash[:notice] = "a friend request was sent to #{@request.destination_url}"
|
||||
redirect_to requests_url
|
||||
|
|
@ -39,13 +39,6 @@ class RequestsController < ApplicationController
|
|||
end
|
||||
|
||||
|
||||
def self.diasproa_url(identifier)
|
||||
if identifier.include? '@'
|
||||
f = Redfinger.finger(uri)
|
||||
identifier = f.each{|x| return x.link if x.rel =='http://joindiaspora.com/seed_location'}
|
||||
end
|
||||
identifier
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ module RequestsHelper
|
|||
def diaspora_url(identifier)
|
||||
if identifier.include? '@'
|
||||
f = Redfinger.finger(identifier)
|
||||
identifier = f.each{|x| return x.link if x.rel =='http://joindiaspora.com/seed_location'}
|
||||
identifier = f.links.each{|x| return x.href if x.rel =='http://joindiaspora.com/seed_location'}
|
||||
end
|
||||
identifier
|
||||
end
|
||||
|
|
|
|||
18
spec/helpers/requests_helper_spec.rb
Normal file
18
spec/helpers/requests_helper_spec.rb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
include RequestsHelper
|
||||
|
||||
describe RequestsHelper do
|
||||
describe "profile" do
|
||||
it 'should fetch the public webfinger profile on request' do
|
||||
#post :create {:request => {:destination_url => 'tom@tom.joindiaspora.com'}
|
||||
|
||||
url = diaspora_url('http://tom.joindiaspora.com/')
|
||||
url.should == 'http://tom.joindiaspora.com/'
|
||||
|
||||
|
||||
url = diaspora_url('tom@tom.joindiaspora.com')
|
||||
url.should == 'http://tom.joindiaspora.com/'
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue