Fix resend links in inviter
This commit is contained in:
parent
98ebb384ca
commit
e30b82dd45
3 changed files with 27 additions and 3 deletions
|
|
@ -92,4 +92,12 @@ class Invitation < ActiveRecord::Base
|
|||
destroy if contact
|
||||
contact
|
||||
end
|
||||
|
||||
def recipient_identifier
|
||||
if recipient.invitation_service == 'email'
|
||||
recipient.invitation_identifier
|
||||
elsif recipient.invitation_service == 'facebook'
|
||||
ServiceUser.where(:uid => recipient.invitation_identifier).first.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -36,11 +36,12 @@
|
|||
%p
|
||||
= invite.submit t('.send_an_invitation')
|
||||
|
||||
- if !@sent_invitations.empty?
|
||||
- unless @sent_invitations.empty?
|
||||
.span-6.last
|
||||
#already_invited_pane
|
||||
%h4
|
||||
= t('.already_invited')
|
||||
- for invitation in @sent_invitations
|
||||
= invitation.recipient.email
|
||||
= invitation.recipient_identifier
|
||||
= link_to t('.resend'), invitation_resend_path(invitation), :confirm => t('are_you_sure')
|
||||
%br
|
||||
|
|
|
|||
|
|
@ -323,5 +323,20 @@ describe Invitation do
|
|||
}.should change(Contact, :count).by(2)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#recipient_identifier' do
|
||||
it 'calls email if the invitation_service is email' do
|
||||
alice.invite_user(aspect.id, 'email', "a@a.com", "")
|
||||
invitation = alice.reload.invitations_from_me.first
|
||||
invitation.recipient_identifier.should == 'a@a.com'
|
||||
end
|
||||
it 'gets the name if the invitation_service is facebook' do
|
||||
alice.services << Services::Facebook.new(:uid => "13234895")
|
||||
alice.reload.services(true).first.service_users.create(:uid => "23526464", :photo_url => 'url', :name => "Remote User")
|
||||
alice.invite_user(aspect.id, 'facebook', "23526464", '')
|
||||
invitation = alice.reload.invitations_from_me.first
|
||||
invitation.recipient_identifier.should == "Remote User"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue