Merge branch 'feature/fix-facebook-public-posts' of git://github.com/jaywink/diaspora into feature/fix_services
Conflicts: Changelog.md app/models/services/facebook.rb spec/models/services/facebook_spec.rb
This commit is contained in:
commit
2a45470232
8 changed files with 21 additions and 20 deletions
|
|
@ -24,12 +24,15 @@
|
|||
## Bug Fixes
|
||||
|
||||
* Fix posting to Facebook and Tumblr. Have a look at the updated [services guide](https://github.com/diaspora/diaspora/wiki/Howto-setup-services) for new Facebook instructions.
|
||||
* Fix overflow button in mobile reset password. [#3697](https://github.com/diaspora/diaspora/pull/3697)
|
||||
* Fix issue with interacted_at in post fetcher. [#3607](https://github.com/diaspora/diaspora/pull/3607)
|
||||
* Fix error with show post Community Spotlight. [#3658](https://github.com/diaspora/diaspora/pull/3658)
|
||||
* Fix javascripts problem with read/unread notifications. [#3656](https://github.com/diaspora/diaspora/pull/3656)
|
||||
* Fix error with open/close registrations. [#3649](https://github.com/diaspora/diaspora/pull/3649)
|
||||
* 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
|
||||
|
||||
|
|
|
|||
|
|
@ -781,3 +781,8 @@ textarea#conversation_text {
|
|||
color: #DF0101;
|
||||
text-shadow: 1px 1px 5px #666;
|
||||
}
|
||||
|
||||
form#new_user.new_user input.btn {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,12 @@ class ServicesController < ApplicationController
|
|||
:service_name => provider.camelize )
|
||||
end
|
||||
end
|
||||
|
||||
render :text => ("<script>window.close()</script>")
|
||||
|
||||
if request.env['omniauth.origin'].nil?
|
||||
render :text => ("<script>window.close()</script>")
|
||||
else
|
||||
redirect_to request.env['omniauth.origin']
|
||||
end
|
||||
end
|
||||
|
||||
def failure
|
||||
|
|
|
|||
|
|
@ -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/#{AppConfig.services.facebook.open_graph_namespace}: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}
|
||||
|
|
|
|||
|
|
@ -16,4 +16,4 @@
|
|||
|
||||
- AppConfig.configured_services.each do |service|
|
||||
- unless @services.any?{|x| x.provider == service}
|
||||
%h4= link_to t("services.index.connect_to_#{service}"), "#", :onclick => "window.open('/auth/#{service}', 'popup', 'height=400,width=500')"
|
||||
%h4= link_to(t("services.index.connect_to_#{service}"), "/auth/#{service}")
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ defaults:
|
|||
enable: false
|
||||
app_id:
|
||||
secret:
|
||||
open_graph_namespace: 'joindiaspora'
|
||||
twitter:
|
||||
enable: false
|
||||
key:
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ configuration: ## Section
|
|||
## Diaspora is only tested against this default pubsub server.
|
||||
## You likely don't want to change this.
|
||||
#pubsub_server: 'https://pubsubhubbub.appspot.com/'
|
||||
|
||||
|
||||
## Settings affecting how ./script/server behaves.
|
||||
server: ## Section
|
||||
## The port on which the appserver should listen
|
||||
#port: 3000
|
||||
|
|
@ -251,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/#{AppConfig.services.facebook.open_graph_namespace}: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/#{AppConfig.services.facebook.open_graph_namespace}: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/#{AppConfig.services.facebook.open_graph_namespace}:make").
|
||||
stub_request(:post, "https://graph.facebook.com/me/feed").
|
||||
to_return(:status => 200)
|
||||
url = "foo"
|
||||
@service.should_not_receive(:public_message)
|
||||
|
|
|
|||
Loading…
Reference in a new issue