DG MS; fixing friend request
This commit is contained in:
parent
1885b5b6b9
commit
da4e148fed
4 changed files with 10 additions and 14 deletions
|
|
@ -12,7 +12,7 @@ class DashboardController < ApplicationController
|
|||
|
||||
puts "SOMEONE JUST SENT ME: #{params[:xml]}"
|
||||
|
||||
store_objects_from_xml params[:xml)
|
||||
store_objects_from_xml CGI::escape( params[:xml] )
|
||||
render :nothing => true
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class PersonRequest
|
|||
def self.for(url)
|
||||
request = PersonRequest.new(:url => url, :person => User.first)
|
||||
request.save
|
||||
request.push_to([self])
|
||||
request.push_to_url
|
||||
end
|
||||
|
||||
def check_for_person_requests
|
||||
|
|
|
|||
|
|
@ -64,7 +64,6 @@ module Diaspora
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
def push_to(recipients)
|
||||
unless recipients.empty?
|
||||
recipients.map!{|x| x = x.url + "receive/"}
|
||||
|
|
@ -74,13 +73,11 @@ module Diaspora
|
|||
end
|
||||
end
|
||||
|
||||
def push_to_url(url)
|
||||
puts "bonedog"
|
||||
if url
|
||||
xml = self.class.build_xml_for([self])
|
||||
@@queue.add_post_request( [url], xml )
|
||||
@@queue.process
|
||||
end
|
||||
def push_to_url
|
||||
hook_url = self.url + "receive/"
|
||||
xml = self.class.build_xml_for([self])
|
||||
@@queue.add_post_request( [hook_url], xml )
|
||||
@@queue.process
|
||||
end
|
||||
|
||||
def prep_webhook
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class MessageHandler
|
|||
|
||||
|
||||
def add_post_request(destinations, body)
|
||||
b = body
|
||||
b = CGI::escape( body )
|
||||
destinations.each{|dest| @queue.push(Message.new(:post, dest, b))}
|
||||
end
|
||||
|
||||
|
|
@ -21,9 +21,8 @@ class MessageHandler
|
|||
@queue.pop{ |query|
|
||||
case query.type
|
||||
when :post
|
||||
puts "sending: #{query.body} to #{query.destination}"
|
||||
http = EventMachine::HttpRequest.new(query.destination).post :timeout => TIMEOUT, :body =>{:xml => query.body}
|
||||
http.callback {puts "success from: to #{query.destination}"; process}
|
||||
http.callback {process}
|
||||
when :get
|
||||
http = EventMachine::HttpRequest.new(query.destination).get :timeout => TIMEOUT
|
||||
http.callback {send_to_seed(query, http.response); process}
|
||||
|
|
@ -32,7 +31,7 @@ class MessageHandler
|
|||
end
|
||||
|
||||
http.errback {
|
||||
puts "fauilure from #{query.destination}, retrying"
|
||||
puts "failure from #{query.destination}, retrying"
|
||||
query.try_count +=1
|
||||
@queue.push query unless query.try_count >= NUM_TRIES
|
||||
process
|
||||
|
|
|
|||
Loading…
Reference in a new issue