diff --git a/app/controllers/requests_controller.rb b/app/controllers/requests_controller.rb index 810b850f1aad10604857959e76c309d8e5dfad62..b58258076ebe3b6569c5c86613f4749b9acc277a 100644 --- a/app/controllers/requests_controller.rb +++ b/app/controllers/requests_controller.rb @@ -26,13 +26,16 @@ class RequestsController < ApplicationController def create url = diaspora_url(params[:request][:destination_url]) - @request = current_user.send_friend_request_to(url) + @request = current_user.send_friend_request_to(url) unless url.include?('@') if @request flash[:notice] = "a friend request was sent to #{@request.destination_url}" redirect_to requests_url else - - flash[:error] = "you have already friended this person" + if url.include? '@' + flash[:error] = "no diaspora seed found with this email!" + else + flash[:error] = "you have already friended this person" + end @request = Request.new render :action => 'new' end diff --git a/app/helpers/requests_helper.rb b/app/helpers/requests_helper.rb index c0bf4a1d8bf4432a4e5da25d17e844dbd687cb68..4d3c37ed380631f04466da98113be4aa78ac5d2f 100644 --- a/app/helpers/requests_helper.rb +++ b/app/helpers/requests_helper.rb @@ -1,10 +1,16 @@ 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'} + + begin + f = Redfinger.finger(identifier) + good_links = f.links.map{|x| return x.href if x.rel =='http://joindiaspora.com/seed_location'} + identifier = good_links.first unless good_links.first.nil? + rescue + + end end + identifier end - end diff --git a/config/sprinkle/packages/ruby.rb b/config/sprinkle/packages/ruby.rb index 644781e7a3d670ac320210c96c90efb5e3416bd7..e90b4e516343478980e982c8fe3db13adc81294a 100644 --- a/config/sprinkle/packages/ruby.rb +++ b/config/sprinkle/packages/ruby.rb @@ -33,7 +33,7 @@ end package :diaspora_dependencies do description 'random dependencies' - apt %w(libxslt1.1 libxslt1-dev libxml2 libgpgme11-dev) + apt %w(libxslt1.1 libxslt1-dev libxml2 libgpgme11-dev ) end #package :diaspora do # description 'Diaspora'