Commit 3dc6517a4ad6475fd3b5507adb1592f0767488ea

Authored by Larissa Reis
1 parent 737f856e

replaces current_user.person for a more clean alternative

Showing 1 changed file with 4 additions and 4 deletions   Show diff stats
app/controllers/public/invite_controller.rb
@@ -23,7 +23,7 @@ class InviteController < PublicController @@ -23,7 +23,7 @@ class InviteController < PublicController
23 webmail_import_addresses = params[:webmail_import_addresses] 23 webmail_import_addresses = params[:webmail_import_addresses]
24 contacts_to_invite = Invitation.join_contacts(manual_import_addresses, webmail_import_addresses) 24 contacts_to_invite = Invitation.join_contacts(manual_import_addresses, webmail_import_addresses)
25 if !contacts_to_invite.empty? 25 if !contacts_to_invite.empty?
26 - Delayed::Job.enqueue InvitationJob.new(current_user.person.id, contacts_to_invite, params[:mail_template], profile.id, @contact_list.id, locale) 26 + Delayed::Job.enqueue InvitationJob.new(user.id, contacts_to_invite, params[:mail_template], profile.id, @contact_list.id, locale)
27 session[:notice] = _('Your invitations are being sent.') 27 session[:notice] = _('Your invitations are being sent.')
28 if profile.person? 28 if profile.person?
29 redirect_to :controller => 'profile', :action => 'friends' 29 redirect_to :controller => 'profile', :action => 'friends'
@@ -59,7 +59,7 @@ class InviteController < PublicController @@ -59,7 +59,7 @@ class InviteController < PublicController
59 def invite_registered_friend 59 def invite_registered_friend
60 contacts_to_invite = params['q'].split(',') 60 contacts_to_invite = params['q'].split(',')
61 if !contacts_to_invite.empty? 61 if !contacts_to_invite.empty?
62 - Delayed::Job.enqueue InvitationJob.new(current_user.person.id, contacts_to_invite, '', profile.id, nil, locale) 62 + Delayed::Job.enqueue InvitationJob.new(user.id, contacts_to_invite, '', profile.id, nil, locale)
63 session[:notice] = _('Your invitations are being sent.') 63 session[:notice] = _('Your invitations are being sent.')
64 if profile.person? 64 if profile.person?
65 redirect_to :controller => 'profile', :action => 'friends' 65 redirect_to :controller => 'profile', :action => 'friends'
@@ -87,8 +87,8 @@ class InviteController < PublicController @@ -87,8 +87,8 @@ class InviteController < PublicController
87 protected 87 protected
88 88
89 def check_permissions_to_invite 89 def check_permissions_to_invite
90 - if profile.person? and !current_user.person.has_permission?(:manage_friends, profile) or  
91 - profile.community? and !current_user.person.has_permission?(:invite_members, profile) 90 + if profile.person? and !user.has_permission?(:manage_friends, profile) or
  91 + profile.community? and !user.has_permission?(:invite_members, profile)
92 render_access_denied 92 render_access_denied
93 end 93 end
94 end 94 end