Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authordanielgrippi <danielgrippi@gmail.com>2011-07-15 06:08:03 +0400
committerRaphael Sofaer <raphael@joindiaspora.com>2011-07-22 05:22:18 +0400
commita8400ad4607e518ecf1b9a1d416956f2bd455317 (patch)
tree3f121278217080381b8b383a80e57518effa2c2b /app
parenta32ef3c1d803f09b82f91a46bc9ca69091df718b (diff)
2 more specs failing. wip
Diffstat (limited to 'app')
-rw-r--r--app/models/reshare.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/app/models/reshare.rb b/app/models/reshare.rb
index 9b80ba533..716780a7d 100644
--- a/app/models/reshare.rb
+++ b/app/models/reshare.rb
@@ -39,11 +39,17 @@ class Reshare < Post
root_author = Webfinger.new(@root_diaspora_id).fetch
root_author.save!
- unless self.root = Post.where(:guid => @root_guid).first
- self.root = Diaspora::Parser.from_xml(Faraday.get(root_author.url + "/p/#{@root_guid}.xml").body)
- self.root.save!
+ local_post = Post.where(:guid => @root_guid).select('id').first
+
+ unless local_post && self.root_id = local_post.id
+ received_post = Diaspora::Parser.from_xml(Faraday.get(root_author.url + "/p/#{@root_guid}.xml").body)
+ unless post = received_post.class.where(:guid => received_post.guid).first
+ post = received_post
+ post.save
+ end
+
+ self.root_id = post.id
end
-
end
def root_must_be_public