diff --git a/app/views/services/_remote_friend.html.haml b/app/views/services/_remote_friend.html.haml index 183cd6886a32441d298e0c9cad1f6315409d6917..02705ce8363ca55ff738d8c61eb3dbe6591db115 100644 --- a/app/views/services/_remote_friend.html.haml +++ b/app/views/services/_remote_friend.html.haml @@ -2,8 +2,15 @@ .right -if friend[:contact] && !friend[:contact].pending = t('people.person.already_connected') - - elsif (friend[:contact] && friend[:contact].pending) + - elsif (friend[:contact] && friend[:contact].pending) || (friend[:request] && friend[:request].sender != friend[:person]) = t('people.person.pending_request') + - elsif (friend[:request] && friend[:request].sender == friend[:person]) + = link_to t('people.show.incoming_request', :name => truncate(person.name, :length => 20, :separator => ' ', :omission => '')), + {:controller => "people", + :action => "show", + :id => friend[:person].id, + :share_with => true}, + :class => 'button' - elsif friend[:invitation_id] = t('invitations.new.already_invited') %br diff --git a/spec/models/services/facebook_spec.rb b/spec/models/services/facebook_spec.rb index 84cd5ad10560eeb999feab541d729021efae5879..39a67a4eac9b2a67c39bb871371203e5dfaa2426 100644 --- a/spec/models/services/facebook_spec.rb +++ b/spec/models/services/facebook_spec.rb @@ -86,13 +86,26 @@ JSON @service.finder["#{@user2_fb_id}"][:person].should be_nil end - it 'contains a request object if one has been sent' do - request = Request.diaspora_initialize(:from => @user2.person, :to => @user.person, :into => @user2.aspects.first) - Postzord::Receiver.new(@user, :object => request, :person => @user2.person).receive_object - Request.count.should == 1 - @service.finder["#{@user2_fb_id}"][:request].should == request + context "request" do + before do + @request = Request.diaspora_initialize(:from => @user2.person, :to => @user.person, :into => @user2.aspects.first) + Postzord::Receiver.new(@user, :object => @request, :person => @user2.person).receive_object + Request.count.should == 1 + end + it 'contains a request object if one has been sent' do + @service.finder["#{@user2_fb_id}"][:request].should == @request + end + + it 'caches the profile' do + @service.finder["#{@user2_fb_id}"][:request].sender.profile.loaded?.should be_true + end + + it 'caches the sender' do + @service.finder["#{@user2_fb_id}"][:request].sender.loaded?.should be_true + end + end - + it 'contains a contact object if connected' do connect_users(@user, @user.aspects.first, @user2, @user2.aspects.first) @service.finder["#{@user2_fb_id}"][:contact].should == @user.reload.contact_for(@user2.person)