pushing for cap deploy
This commit is contained in:
parent
fcdba64828
commit
4077e4248e
2 changed files with 12 additions and 4 deletions
|
|
@ -4,7 +4,8 @@ class Comment
|
||||||
include Diaspora::Webhooks
|
include Diaspora::Webhooks
|
||||||
|
|
||||||
xml_accessor :text
|
xml_accessor :text
|
||||||
xml_reader :person, :to_xml => proc {|person| person.email}
|
xml_accessor :person, :as => Person
|
||||||
|
xml_accessor :post_id
|
||||||
|
|
||||||
key :text, String
|
key :text, String
|
||||||
key :target, String
|
key :target, String
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,16 @@ module Diaspora
|
||||||
|
|
||||||
def parse_sender_object_from_xml(xml)
|
def parse_sender_object_from_xml(xml)
|
||||||
sender_id = parse_sender_id_from_xml(xml)
|
sender_id = parse_sender_id_from_xml(xml)
|
||||||
Friend.where(:email => sender_id).first
|
Friend.where(:email =>sender_id ).first
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def parse_owner_from_xml(xml)
|
def parse_owner_from_xml(xml)
|
||||||
doc = Nokogiri::XML(xml) { |cfg| cfg.noblanks }
|
doc = Nokogiri::XML(xml) { |cfg| cfg.noblanks }
|
||||||
email = doc.xpath("/person/email").text.to_s
|
email = doc.xpath("/person/email").text.to_s
|
||||||
Friend.where(:email => sender_id).first
|
Friend.where(:email => email).first
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_body_contents_from_xml(xml)
|
def parse_body_contents_from_xml(xml)
|
||||||
|
|
@ -29,8 +31,13 @@ module Diaspora
|
||||||
body.children.each do |post|
|
body.children.each do |post|
|
||||||
begin
|
begin
|
||||||
object = post.name.camelize.constantize.from_xml post.to_s
|
object = post.name.camelize.constantize.from_xml post.to_s
|
||||||
puts post.to_s
|
|
||||||
object.person = parse_owner_from_xml post.to_s #if object.is_a? Post
|
object.person = parse_owner_from_xml post.to_s #if object.is_a? Post
|
||||||
|
|
||||||
|
# if object.is_a? Comment
|
||||||
|
# object.post = parse_post_
|
||||||
|
# end
|
||||||
|
|
||||||
|
|
||||||
objects << object
|
objects << object
|
||||||
rescue
|
rescue
|
||||||
puts "Not a real type: #{object.to_s}"
|
puts "Not a real type: #{object.to_s}"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue