Merge branch 'master' of github.com:diaspora/diaspora_rails
This commit is contained in:
commit
180138610c
7 changed files with 62 additions and 1 deletions
3
Gemfile
3
Gemfile
|
|
@ -28,6 +28,9 @@ gem 'pubsubhubbub'
|
|||
gem 'em-http-request',:git => 'git://github.com/igrigorik/em-http-request.git', :require => 'em-http'
|
||||
gem 'addressable', :require => 'addressable/uri'
|
||||
gem 'em-websocket'
|
||||
gem 'thin'
|
||||
gem 'will_paginate', '3.0.pre'
|
||||
gem 'redfinger'
|
||||
|
||||
#File uploading
|
||||
gem 'carrierwave', :git => 'git://github.com/rsofaer/carrierwave.git' , :branch => 'master' #Untested mongomapper branch
|
||||
|
|
|
|||
|
|
@ -25,7 +25,8 @@ class RequestsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
@request = current_user.send_friend_request_to(params[:request][:destination_url])
|
||||
url = diaspora_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
|
||||
|
|
@ -38,4 +39,8 @@ class RequestsController < ApplicationController
|
|||
end
|
||||
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,2 +1,10 @@
|
|||
module RequestsHelper
|
||||
def diaspora_url(identifier)
|
||||
if identifier.include? '@'
|
||||
f = Redfinger.finger(identifier)
|
||||
identifier = f.links.each{|x| return x.href if x.rel =='http://joindiaspora.com/seed_location'}
|
||||
end
|
||||
identifier
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,4 +4,5 @@
|
|||
<Alias>"<%=@user.url%>hcard"</Alias>
|
||||
<Link rel="http://microformats.org/profile/hcard" type="text/html" href="<%=@user.url%>hcard"/>
|
||||
<Link rel="http://schemas.google.com/g/2010#updates-from" type="application/atom+xml" href="<%=@user.url%>status_messages.atom"/>
|
||||
<Link rel="http://joindiaspora.com/seed_location" type = 'text/html' href="<%=@user.url%>"/>
|
||||
</XRD>
|
||||
|
|
|
|||
16
spec/controllers/requests_controller_spec.rb
Normal file
16
spec/controllers/requests_controller_spec.rb
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe RequestsController do
|
||||
describe "profile" do
|
||||
it 'should fetch the public webfinger profile on request' do
|
||||
#post :create {:request => {:destination_url => 'tom@tom.joindiaspora.com'}
|
||||
|
||||
url = RequestsController.diaspora_url('http://tom.joindiasproa.com')
|
||||
url.should == 'htto://tom.joindiaspora.com'
|
||||
|
||||
|
||||
url = RequestsController.diaspora_url('tom@tom.joindiaspora.com')
|
||||
url.should == 'http://tom.joindiaspora.com'
|
||||
end
|
||||
end
|
||||
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
|
||||
10
spec/models/webfinger_spec.rb
Normal file
10
spec/models/webfinger_spec.rb
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'webfinger' do
|
||||
redner_views
|
||||
describe "profile" do
|
||||
it 'should fetch the public webfinger profile on request' do
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Reference in a new issue