Skip to content

Commit

Permalink
Avoid using Pundit.policy in _form_fields partial
Browse files Browse the repository at this point in the history
We're already using the `policy` helper method elsewhere so let's use
that consistently. This also avoids us having to pass the `current_user`
in.
  • Loading branch information
chrisroos committed Oct 3, 2023
1 parent 32896c5 commit a743532
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/views/users/_form_fields.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<% if @user.exempt_from_2sv? %>
<p>
The user has been made exempt from 2-step verification for the following reason: <%= @user.reason_for_2sv_exemption %>
<% if Pundit.policy(current_user, @user).exempt_from_two_step_verification? %>
<% if policy(@user).exempt_from_two_step_verification? %>
<br>
<%= link_to 'Edit reason or expiry date for 2-step verification exemption', edit_two_step_verification_exemption_path(@user) %>
<% end %>
Expand Down Expand Up @@ -77,7 +77,7 @@
<br/>
User will be prompted to set up 2-step verification again the next time they sign in.</p>
<% end %>
<% if @user.persisted? && Pundit.policy(current_user, @user).exempt_from_two_step_verification? && @user.reason_for_2sv_exemption.nil? %>
<% if @user.persisted? && policy(@user).exempt_from_two_step_verification? && @user.reason_for_2sv_exemption.nil? %>
<p>
<%= link_to 'Exempt user from 2-step verification', edit_two_step_verification_exemption_path(@user) %>
<br/>
Expand Down

0 comments on commit a743532

Please sign in to comment.