DG IZ friend request, has a puts in the receive hook for debugging
This commit is contained in:
parent
b496ee567a
commit
ebfc55ff28
2 changed files with 19 additions and 6 deletions
|
|
@ -1,8 +1,11 @@
|
||||||
class PersonRequest
|
class PersonRequest
|
||||||
|
require 'lib/common'
|
||||||
|
include ApplicationHelper
|
||||||
include MongoMapper::Document
|
include MongoMapper::Document
|
||||||
include Diaspora::Webhooks
|
|
||||||
include ROXML
|
include ROXML
|
||||||
|
include Diaspora::Webhooks
|
||||||
|
|
||||||
|
|
||||||
xml_name :person_request
|
xml_name :person_request
|
||||||
|
|
||||||
xml_accessor :_id
|
xml_accessor :_id
|
||||||
|
|
@ -16,11 +19,9 @@ class PersonRequest
|
||||||
before_save :check_for_person_requests
|
before_save :check_for_person_requests
|
||||||
|
|
||||||
def self.for(url)
|
def self.for(url)
|
||||||
request = PersonRequest.new(:url => url)
|
request = PersonRequest.new(:url => url, :person => User.first)
|
||||||
request.person = User.first
|
|
||||||
request.save
|
request.save
|
||||||
|
request.push_to_url(url)
|
||||||
request.push_to([request])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_for_person_requests
|
def check_for_person_requests
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ module Diaspora
|
||||||
|
|
||||||
def store_objects_from_xml(xml)
|
def store_objects_from_xml(xml)
|
||||||
objects = parse_objects_from_xml(xml)
|
objects = parse_objects_from_xml(xml)
|
||||||
|
|
||||||
|
puts xml
|
||||||
|
|
||||||
objects.each do |p|
|
objects.each do |p|
|
||||||
if p.is_a? Retraction
|
if p.is_a? Retraction
|
||||||
|
|
@ -72,6 +74,16 @@ module Diaspora
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def push_to_url(url)
|
||||||
|
if url
|
||||||
|
puts "AHHHHHH, sending"
|
||||||
|
xml = self.class.build_xml_for([self])
|
||||||
|
puts xml
|
||||||
|
@@queue.add_post_request( [url], xml )
|
||||||
|
@@queue.process
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def prep_webhook
|
def prep_webhook
|
||||||
"<post>#{self.to_xml.to_s}</post>"
|
"<post>#{self.to_xml.to_s}</post>"
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue