DG MS; ensure aspect post_ids are only for user

This commit is contained in:
maxwell 2010-10-13 16:54:18 -07:00
parent b395208a51
commit f04934cbae
2 changed files with 10 additions and 2 deletions

View file

@ -14,6 +14,7 @@ module Diaspora
module XML
def execute(user)
builder = Nokogiri::XML::Builder.new do |xml|
user_person_id = user.person.id
xml.export {
xml.user {
xml.username user.username
@ -33,7 +34,7 @@ module Diaspora
}
xml.post_ids {
aspect.posts.each do |post|
aspect.posts.find_all_by_person_id(user_person_id).each do |post|
xml.post_id post.id
end
}
@ -48,7 +49,7 @@ module Diaspora
}
xml.posts {
user.raw_visible_posts.find_all_by_person_id(user.person.id).each do |post|
user.raw_visible_posts.find_all_by_person_id(user_person_id).each do |post|
#post_doc = post.to_xml
#post.comments.each do |comment|

View file

@ -50,4 +50,11 @@ describe Diaspora::Exporter do
doc = Nokogiri::XML::parse(exported)
doc.xpath('/export/people').to_s.should include user3.person.id.to_s
end
it 'should serialize only a users posts within his aspects' do
message = Factory(:status_message, :message => "Shouldn't be here", :person => user3.person)
aspect1.posts << message
doc = Nokogiri::XML::parse(exported)
doc.xpath('/export/aspects').to_s.should_not include message.message
end
end