From 633e1337131872cfe936a9679ccc16b0aa74dae0 Mon Sep 17 00:00:00 2001
From: nilsding <nilsding@nilsding.org>
Date: Sat, 13 Dec 2014 15:38:16 +0100
Subject: [PATCH] sharing now works for real.

---
 app/controllers/ajax/inbox_controller.rb | 4 ++--
 app/models/services/twitter.rb           | 1 -
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/app/controllers/ajax/inbox_controller.rb b/app/controllers/ajax/inbox_controller.rb
index 5cf8132d..0a1eb923 100644
--- a/app/controllers/ajax/inbox_controller.rb
+++ b/app/controllers/ajax/inbox_controller.rb
@@ -47,10 +47,10 @@ class Ajax::InboxController < ApplicationController
     end
 
     # sharing
-    share_to = JSON.parse params[:share]
     Thread.new do
+      share_to = JSON.parse params[:share]
       current_user.services.each do |service|
-        service.post answer if share_to.include? service.provider
+        service.post(answer) if share_to.include? service.provider
       end
     end
 
diff --git a/app/models/services/twitter.rb b/app/models/services/twitter.rb
index 69cb0d66..04ea97ce 100644
--- a/app/models/services/twitter.rb
+++ b/app/models/services/twitter.rb
@@ -35,7 +35,6 @@ class Services::Twitter < Service
         host: APP_CONFIG['hostname'],
         protocol: (APP_CONFIG['https'] ? :https : :http)
       )
-      Rails.logger.debug "answer_url => #{answer_url}"
       "#{question_content[0..55]}#{'…' if question_content.length > 56}" \
         " — #{answer_content[0..55]}#{'…' if answer_content.length > 56} #{answer_url}"
     end