Skip to content
Extraits de code Groupes Projets
Valider e974d293 rédigé par Jason Robinson's avatar Jason Robinson
Parcourir les fichiers

Always use basic Facebook Graph API to post messages, fixes public posts....

Always use basic Facebook Graph API to post messages, fixes public posts. Remove unnecessary Facebook opengraph config items
parent 3aef807f
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -31,6 +31,7 @@
* Fix javascripts error in invitations facebox. [#3638](https://github.com/diaspora/diaspora/pull/3638)
* Fix css overflow problem in aspect dropdown on welcome page. [#3637](https://github.com/diaspora/diaspora/pull/3637)
* Fix empty page after authenticating with other services. [#3693](https://github.com/diaspora/diaspora/pull/3693)
* Fix posting public posts to Facebook. [#2882](https://github.com/diaspora/diaspora/issues/2882), [#3650](https://github.com/diaspora/diaspora/issues/3650)
# 0.0.1.2
......
......@@ -11,21 +11,13 @@ class Services::Facebook < Service
def post(post, url='')
Rails.logger.debug("event=post_to_service type=facebook sender_id=#{self.user_id}")
if post.public?
post_to_facebook("https://graph.facebook.com/me/joindiaspora:make", create_open_graph_params(post).to_param)
else
post_to_facebook("https://graph.facebook.com/me/feed", create_post_params(post).to_param)
end
post_to_facebook("https://graph.facebook.com/me/feed", create_post_params(post).to_param)
end
def post_to_facebook(url, body)
Faraday.post(url, body)
end
def create_open_graph_params(post)
{:post => "#{AppConfig.pod_uri.to_s}#{short_post_path(post)}", :access_token => self.access_token}
end
def create_post_params(post)
message = post.text(:plain_text => true)
{:message => message, :access_token => self.access_token, :link => URI.extract(message, ['https', 'http']).first}
......
......@@ -56,7 +56,6 @@ defaults:
enable: false
app_id:
secret:
open_graph_namespace: 'joindiaspora'
twitter:
enable: false
key:
......
......@@ -252,9 +252,6 @@ configuration: ## Section
#enable: true
#app_id: 'abcdef'
#secret: 'changeme'
## this will be the namespace for your object,
## it should be configured in your FB app
#open_graph_namespace:
## OAuth credentials for Twitter:
twitter: ## Section
......
......@@ -11,7 +11,7 @@ describe Services::Facebook do
describe '#post' do
it 'posts a status message to facebook' do
stub_request(:post, "https://graph.facebook.com/me/joindiaspora:make").
stub_request(:post, "https://graph.facebook.com/me/feed").
to_return(:status => 200, :body => "", :headers => {})
@service.post(@post)
end
......@@ -19,13 +19,13 @@ describe Services::Facebook do
it 'swallows exception raised by facebook always being down' do
pending "temporarily disabled to figure out while some requests are failing"
stub_request(:post,"https://graph.facebook.com/me/joindiaspora:make").
stub_request(:post,"https://graph.facebook.com/me/feed").
to_raise(StandardError)
@service.post(@post)
end
it 'should call public message' do
stub_request(:post, "https://graph.facebook.com/me/joindiaspora:make").
stub_request(:post, "https://graph.facebook.com/me/feed").
to_return(:status => 200)
url = "foo"
@service.should_not_receive(:public_message)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter