diff options
author | danielgrippi <danielgrippi@gmail.com> | 2011-07-14 06:40:08 +0400 |
---|---|---|
committer | Raphael Sofaer <raphael@joindiaspora.com> | 2011-07-22 05:22:17 +0400 |
commit | 509a435cc9c6b608923b3a03347584bda76be5e7 (patch) | |
tree | 8aae4415231320a0b0d0777a1093235cdce1cfb8 /app | |
parent | 7b3180e5da4a6dab67e543f237b3a9b6de1bc72f (diff) |
moving to not including the post in the reshare xml
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/publics_controller.rb | 2 | ||||
-rw-r--r-- | app/models/reshare.rb | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/app/controllers/publics_controller.rb b/app/controllers/publics_controller.rb index dc1a338fb..1b59bd1ef 100644 --- a/app/controllers/publics_controller.rb +++ b/app/controllers/publics_controller.rb @@ -66,7 +66,7 @@ class PublicsController < ApplicationController end def post - @post = Post.where(:id => params[:id], :public => true).includes(:author, :comments => :author).first + @post = Post.where(:guid => params[:guid], :public => true).includes(:author, :comments => :author).first #hax to upgrade logged in users who can comment if @post diff --git a/app/models/reshare.rb b/app/models/reshare.rb index 08853dee9..fb1c59542 100644 --- a/app/models/reshare.rb +++ b/app/models/reshare.rb @@ -3,10 +3,32 @@ class Reshare < Post validate :root_must_be_public attr_accessible :root_id, :public + xml_attr :root_diaspora_id + xml_attr :root_guid + + attr_accessible :root_diaspora_id, :root_guid + before_validation do self.public = true end + def root_guid + self.root.guid + end + def root_guid= rg + #self.root = Post.where(:guid => rg).first + debugger + person = Person.where(:diaspora_handle => self[:root_diaspora_id]).first + Faraday.get(person.url + public_post_path(:guid => rg)) + end + + def root_diaspora_id + self.root.author.diaspora_handle + end + def root_diaspora_id= id + Webfinger.new(id).fetch + end + def receive(user, person) local_reshare = Reshare.where(:guid => self.guid).first if local_reshare.root.author_id == user.person.id |