Merge pull request #5493 from collimarco/solved5341

This commit is contained in:
Jonne Haß 2015-01-06 14:40:26 +01:00
commit 9c99ae357a
3 changed files with 14 additions and 4 deletions

View file

@ -113,6 +113,7 @@ diaspora.yml file**. The existing settings from 0.4.x and before will not work a
* Improve consistency of poll answer ordering [#5471](https://github.com/diaspora/diaspora/pull/5471) * Improve consistency of poll answer ordering [#5471](https://github.com/diaspora/diaspora/pull/5471)
* Fix broken aspect selectbox on asynchronous search results [#5488](https://github.com/diaspora/diaspora/pull/5488) * Fix broken aspect selectbox on asynchronous search results [#5488](https://github.com/diaspora/diaspora/pull/5488)
* Replace %{third_party_tools} by the appropriate hyperlink in tags FAQ [#5509](https://github.com/diaspora/diaspora/pull/5509) * Replace %{third_party_tools} by the appropriate hyperlink in tags FAQ [#5509](https://github.com/diaspora/diaspora/pull/5509)
* Repair downloading the profile image from Facebook [#5493](https://github.com/diaspora/diaspora/pull/5493)
## Features ## Features
* Don't pull jQuery from a CDN by default [#5105](https://github.com/diaspora/diaspora/pull/5105) * Don't pull jQuery from a CDN by default [#5105](https://github.com/diaspora/diaspora/pull/5105)

View file

@ -23,9 +23,9 @@ class ServicesController < ApplicationController
service = Service.initialize_from_omniauth( omniauth_hash ) service = Service.initialize_from_omniauth( omniauth_hash )
if current_user.services << service if current_user.services << service
current_user.update_profile_with_omniauth( service.info ) no_profile_image_before_update = no_profile_image?
current_user.update_profile_with_omniauth(service.info)
fetch_photo(service) if no_profile_image? fetch_photo(service) if no_profile_image_before_update
flash[:notice] = I18n.t 'services.create.success' flash[:notice] = I18n.t 'services.create.success'
else else

View file

@ -8,7 +8,7 @@ describe ServicesController, :type => :controller do
let(:omniauth_auth) do let(:omniauth_auth) do
{ 'provider' => 'facebook', { 'provider' => 'facebook',
'uid' => '2', 'uid' => '2',
'info' => { 'nickname' => 'grimmin' }, 'info' => { 'nickname' => 'grimmin', 'image' => 'http://graph.facebook.com/2/picture' },
'credentials' => { 'token' => 'tokin', 'secret' =>"not_so_much" }} 'credentials' => { 'token' => 'tokin', 'secret' =>"not_so_much" }}
end end
let(:user) { alice } let(:user) { alice }
@ -46,6 +46,15 @@ describe ServicesController, :type => :controller do
expect(user.reload.services.first.class.name).to eq("Services::Facebook") expect(user.reload.services.first.class.name).to eq("Services::Facebook")
end end
context "when the user hasn't got a profile photo on Diaspora" do
before { user.person.profile.update_attribute :image_url, nil }
it "imports the profile photo from the service" do
expect(Workers::FetchProfilePhoto).to receive(:perform_async)
post :create, :provider => 'facebook'
end
end
context 'when service exists with the same uid' do context 'when service exists with the same uid' do
before { Services::Twitter.create!(uid: omniauth_auth['uid'], user_id: user.id) } before { Services::Twitter.create!(uid: omniauth_auth['uid'], user_id: user.id) }