MS kinda hacky webfinger email fix
This commit is contained in:
parent
180138610c
commit
5d0c5dbd86
3 changed files with 16 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Reference in a new issue