Browse Source

Merge dd13a4a585 into 4af4c948e9

pull/3103/merge
Samuel Young 3 days ago committed by GitHub
parent
commit
4da2d21514
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 5
      app/views/users/show.html.erb
  2. 13
      spec/features/user_spec.rb

5
app/views/users/show.html.erb

@ -154,7 +154,10 @@
<div class="govuk-button-group"> <div class="govuk-button-group">
<% if @user.active? %> <% if @user.active? %>
<%= govuk_button_link_to "Deactivate user", deactivate_user_path(@user), warning: true %> <%= govuk_button_link_to "Deactivate user", deactivate_user_path(@user), warning: true %>
<% if current_user.support? && @user.last_sign_in_at.nil? %> <%# Some users are confirmed but have no sign in date, since logging in is a separate step that happens after confirmation %>
<%# Some users are unconfirmed but have a sign in date, since deactivating an account will unconfirm but not reset login date %>
<%# So, allow both cases to receive invite links %>
<% if current_user.support? && (@user.last_sign_in_at.nil? || !@user.confirmed?) %>
<%= govuk_button_to "Resend invite link", resend_invite_user_path(@user), secondary: true %> <%= govuk_button_to "Resend invite link", resend_invite_user_path(@user), secondary: true %>
<% end %> <% end %>
<% else %> <% else %>

13
spec/features/user_spec.rb

@ -608,6 +608,19 @@ RSpec.describe "User Features" do
click_button("Resend invite link") click_button("Resend invite link")
end end
end end
context "when reactivating a user" do
let!(:other_user) { create(:user, name: "Other name", active: false, organisation: user.organisation, last_sign_in_at: Time.zone.now, confirmed_at: nil) }
it "allows for reactivation email to be resent" do
allow(user).to receive(:need_two_factor_authentication?).and_return(false)
sign_in(user)
visit(user_path(other_user))
click_link("Reactivate user")
click_button("I’m sure – reactivate this user")
expect(page).to have_button("Resend invite link")
end
end
end end
context "when the user is a customer support person" do context "when the user is a customer support person" do

Loading…
Cancel
Save