Fix 500 on invitations new on unknown facebook user... bad solution, maybe we should just delete the offending invitations?
This commit is contained in:
parent
3431cd94fb
commit
350a4b4f6d
3 changed files with 14 additions and 1 deletions
|
|
@ -96,7 +96,11 @@ class Invitation < ActiveRecord::Base
|
|||
if recipient.invitation_service == 'email'
|
||||
recipient.invitation_identifier
|
||||
elsif recipient.invitation_service == 'facebook'
|
||||
ServiceUser.where(:uid => recipient.invitation_identifier).first.name
|
||||
if su = ServiceUser.where(:uid => recipient.invitation_identifier).first
|
||||
su.name
|
||||
else
|
||||
I18n.t('invitations.a_facebook_user')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -305,6 +305,7 @@ en:
|
|||
edit:
|
||||
your_account_awaits: "Your account awaits!"
|
||||
accept_your_invitation: "Accept your invitation"
|
||||
a_facebook_user: "A Facebook user"
|
||||
|
||||
layouts:
|
||||
header:
|
||||
|
|
|
|||
|
|
@ -337,6 +337,14 @@ describe Invitation do
|
|||
invitation = alice.reload.invitations_from_me.first
|
||||
invitation.recipient_identifier.should == "Remote User"
|
||||
end
|
||||
it 'does not error if the facebook user is not recorded' 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", '')
|
||||
alice.services.first.service_users.delete_all
|
||||
invitation = alice.reload.invitations_from_me.first
|
||||
invitation.recipient_identifier.should == "A Facebook user"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue