Commit 3dc6517a4ad6475fd3b5507adb1592f0767488ea
1 parent
737f856e
Exists in
master
and in
27 other branches
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 | 23 | webmail_import_addresses = params[:webmail_import_addresses] |
| 24 | 24 | contacts_to_invite = Invitation.join_contacts(manual_import_addresses, webmail_import_addresses) |
| 25 | 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 | 27 | session[:notice] = _('Your invitations are being sent.') |
| 28 | 28 | if profile.person? |
| 29 | 29 | redirect_to :controller => 'profile', :action => 'friends' |
| ... | ... | @@ -59,7 +59,7 @@ class InviteController < PublicController |
| 59 | 59 | def invite_registered_friend |
| 60 | 60 | contacts_to_invite = params['q'].split(',') |
| 61 | 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 | 63 | session[:notice] = _('Your invitations are being sent.') |
| 64 | 64 | if profile.person? |
| 65 | 65 | redirect_to :controller => 'profile', :action => 'friends' |
| ... | ... | @@ -87,8 +87,8 @@ class InviteController < PublicController |
| 87 | 87 | protected |
| 88 | 88 | |
| 89 | 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 | 92 | render_access_denied |
| 93 | 93 | end |
| 94 | 94 | end | ... | ... |