Skip to content
Extraits de code Groupes Projets
Valider 18013861 rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

Merge branch 'master' of github.com:diaspora/diaspora_rails

parents 04eb66b2 44b4defb
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -28,6 +28,9 @@ gem 'pubsubhubbub' ...@@ -28,6 +28,9 @@ gem 'pubsubhubbub'
gem 'em-http-request',:git => 'git://github.com/igrigorik/em-http-request.git', :require => 'em-http' gem 'em-http-request',:git => 'git://github.com/igrigorik/em-http-request.git', :require => 'em-http'
gem 'addressable', :require => 'addressable/uri' gem 'addressable', :require => 'addressable/uri'
gem 'em-websocket' gem 'em-websocket'
gem 'thin'
gem 'will_paginate', '3.0.pre'
gem 'redfinger'
#File uploading #File uploading
gem 'carrierwave', :git => 'git://github.com/rsofaer/carrierwave.git' , :branch => 'master' #Untested mongomapper branch gem 'carrierwave', :git => 'git://github.com/rsofaer/carrierwave.git' , :branch => 'master' #Untested mongomapper branch
......
...@@ -25,7 +25,8 @@ class RequestsController < ApplicationController ...@@ -25,7 +25,8 @@ class RequestsController < ApplicationController
end end
def create 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 if @request
flash[:notice] = "a friend request was sent to #{@request.destination_url}" flash[:notice] = "a friend request was sent to #{@request.destination_url}"
redirect_to requests_url redirect_to requests_url
...@@ -38,4 +39,8 @@ class RequestsController < ApplicationController ...@@ -38,4 +39,8 @@ class RequestsController < ApplicationController
end end
private
end end
module RequestsHelper 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 end
...@@ -4,4 +4,5 @@ ...@@ -4,4 +4,5 @@
<Alias>"<%=@user.url%>hcard"</Alias> <Alias>"<%=@user.url%>hcard"</Alias>
<Link rel="http://microformats.org/profile/hcard" type="text/html" href="<%=@user.url%>hcard"/> <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://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> </XRD>
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
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
require 'spec_helper'
describe 'webfinger' do
redner_views
describe "profile" do
it 'should fetch the public webfinger profile on request' do
end
end
end
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter