From 8ca5ca7c92bc3960bce80c17b1fb33aa724bfdff Mon Sep 17 00:00:00 2001 From: Steffen van Bergerem Date: Sat, 4 Oct 2014 01:14:42 +0200 Subject: Reshare the absolute root of a post --- app/controllers/reshares_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/controllers/reshares_controller.rb b/app/controllers/reshares_controller.rb index 7fc4e815f..1e49a5aa0 100644 --- a/app/controllers/reshares_controller.rb +++ b/app/controllers/reshares_controller.rb @@ -3,7 +3,13 @@ class ResharesController < ApplicationController respond_to :json def create - @reshare = current_user.build_post(:reshare, :root_guid => params[:root_guid]) + post = Post.where(:guid => params[:root_guid]).first + if post.is_a? Reshare + @reshare = current_user.build_post(:reshare, :root_guid => post.absolute_root.guid) + else + @reshare = current_user.build_post(:reshare, :root_guid => params[:root_guid]) + end + if @reshare.save current_user.add_to_streams(@reshare, current_user.aspects) current_user.dispatch_post(@reshare, :url => post_url(@reshare), :additional_subscribers => @reshare.root_author) -- cgit v1.2.3