added the pending request to the finder

This commit is contained in:
zhitomirskiyi 2011-02-08 18:49:33 -08:00
parent 80117d8ab6
commit 6be63b88f0
2 changed files with 27 additions and 7 deletions

View file

@ -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

View file

@ -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)