Skip to content

Commit

Permalink
Change "signup email" to "invitation email"
Browse files Browse the repository at this point in the history
Updated content provided by Etain.
  • Loading branch information
chrisroos committed Feb 6, 2024
1 parent 606562e commit 72482d1
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion app/controllers/invitations_controller.rb
Expand Up @@ -68,7 +68,7 @@ def invitee_requires_2sv(params)
def redirect_if_invitee_already_exists
if (resource = User.find_by(email: params[:user][:email]))
authorize resource
flash[:alert] = "User already invited. If you want to, you can click 'Resend signup email'."
flash[:alert] = "User already invited. If you want to, you can click 'Resend invitation email'."
respond_with resource, location: users_path
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/invitation_resends_controller.rb
Expand Up @@ -9,7 +9,7 @@ def edit; end
def update
@user.invite!(current_user)
EventLog.record_account_invitation(@user, current_user)
flash[:notice] = "Resent account signup email to #{@user.email}"
flash[:notice] = "Resent account invitation email to #{@user.email}"
redirect_to edit_user_path(@user)
end

Expand Down
2 changes: 1 addition & 1 deletion app/helpers/users_helper.rb
Expand Up @@ -161,7 +161,7 @@ def link_to_resend_invitation(user)
return unless policy(user).resend_invitation?
return unless user.invited_but_not_yet_accepted?

link_to "Resend signup email", edit_user_invitation_resend_path(user), class: "govuk-link"
link_to "Resend invitation email", edit_user_invitation_resend_path(user), class: "govuk-link"
end

def link_to_unlock(user)
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/emails/edit.html.erb
Expand Up @@ -59,7 +59,7 @@
id: "user_email",
type: "email",
value: @user.email,
hint: @user.web_user? && @user.invited_but_not_yet_accepted? ? "Changes will trigger a new signup email." : nil,
hint: @user.web_user? && @user.invited_but_not_yet_accepted? ? "Changes will trigger a new invitation email." : nil,
autocomplete: "off",
error_items: @user.errors.full_messages_for(:email).map { |message| { text: message } }
} %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/users/invitation_resends/edit.html.erb
@@ -1,5 +1,5 @@
<% content_for :title_caption, "Manage other users" %>
<% content_for :title, "Resend signup email for #{@user.name}" %>
<% content_for :title, "Resend invitation email for #{@user.name}" %>
<% content_for :breadcrumbs,
render("govuk_publishing_components/components/breadcrumbs", {
Expand Down Expand Up @@ -30,7 +30,7 @@

<div class="govuk-button-group">
<%= render "govuk_publishing_components/components/button", {
text: "Resend signup email",
text: "Resend invitation email",
} %>
<%= link_to "Cancel", edit_user_path(@user), class: "govuk-link govuk-link--no-visited-state" %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/troubleshooting.md
Expand Up @@ -10,7 +10,7 @@ In the first instance, a new email should be requested. The route is different d

### New user account

As a superadmin user, in Signon, find the user and press the 'Resend signup email' button.
As a superadmin user, in Signon, find the user and press the 'Resend invitation email' button.

### Password reset email

Expand Down
2 changes: 1 addition & 1 deletion test/controllers/invitations_controller_test.rb
Expand Up @@ -417,7 +417,7 @@ class InvitationsControllerTest < ActionController::TestCase
post :create, params: { user: { name: existing_user.name, email: existing_user.email } }

assert_redirected_to users_path
assert_equal "User already invited. If you want to, you can click 'Resend signup email'.", flash[:alert]
assert_equal "User already invited. If you want to, you can click 'Resend invitation email'.", flash[:alert]
end
end

Expand Down
10 changes: 5 additions & 5 deletions test/controllers/users/invitation_resends_controller_test.rb
Expand Up @@ -18,7 +18,7 @@ class Users::InvitationResendsControllerTest < ActionController::TestCase

assert_template :edit
assert_select "form[action='#{user_invitation_resend_path(user)}']" do
assert_select "button[type='submit']", text: "Resend signup email"
assert_select "button[type='submit']", text: "Resend invitation email"
assert_select "a[href='#{edit_user_path(user)}']", text: "Cancel"
end
end
Expand Down Expand Up @@ -87,7 +87,7 @@ class Users::InvitationResendsControllerTest < ActionController::TestCase
sign_in(@admin)
end

should "resend signup email" do
should "resend invitation email" do
user = create(:invited_user)

perform_enqueued_jobs do
Expand Down Expand Up @@ -131,10 +131,10 @@ class Users::InvitationResendsControllerTest < ActionController::TestCase
put :update, params: { user_id: user }

assert_redirected_to edit_user_path(user)
assert_equal "Resent account signup email to user@gov.uk", flash[:notice]
assert_equal "Resent account invitation email to user@gov.uk", flash[:notice]
end

should "resend signup email if UserPolicy#resend_invitation? returns true" do
should "resend invitation email if UserPolicy#resend_invitation? returns true" do
user = create(:invited_user)

stub_policy(@admin, user, resend_invitation?: true)
Expand All @@ -144,7 +144,7 @@ class Users::InvitationResendsControllerTest < ActionController::TestCase
end
end

should "not resend signup email if UserPolicy#resend_invitation? returns false" do
should "not resend invitation email if UserPolicy#resend_invitation? returns false" do
user = create(:invited_user)

stub_policy(@admin, user, resend_invitation?: false)
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/users_controller_test.rb
Expand Up @@ -320,7 +320,7 @@ class UsersControllerTest < ActionController::TestCase

get :edit, params: { id: user }

assert_select "a[href='#{edit_user_invitation_resend_path(user)}']", text: "Resend signup email"
assert_select "a[href='#{edit_user_invitation_resend_path(user)}']", text: "Resend invitation email"
end

should "display link to unlock user page" do
Expand Down
8 changes: 4 additions & 4 deletions test/helpers/users_helper_test.rb
Expand Up @@ -295,16 +295,16 @@ class UsersHelperTest < ActionView::TestCase
end

context "#link_to_resend_invitation" do
context "when current user has permission to resend signup email to a user" do
context "when current user has permission to resend invitation email to a user" do
setup do
stubs(:policy).returns(stub("policy", resend_invitation?: true))
end

should "returns link to resend signup email to user for invited user" do
should "returns link to resend invitation email to user for invited user" do
user = build(:invited_user, id: 123)
html = link_to_resend_invitation(user)
node = Nokogiri::HTML5.fragment(html)
assert_select node, "a[href='#{edit_user_invitation_resend_path(user)}']", text: "Resend signup email"
assert_select node, "a[href='#{edit_user_invitation_resend_path(user)}']", text: "Resend invitation email"
end

should "returns nil for user who has accepted invitation" do
Expand All @@ -313,7 +313,7 @@ class UsersHelperTest < ActionView::TestCase
end
end

context "when current user does not have permission to resend signup email to a user" do
context "when current user does not have permission to resend invitation email to a user" do
setup do
stubs(:policy).returns(stub("policy", resend_invitation?: false))
end
Expand Down
6 changes: 3 additions & 3 deletions test/integration/inviting_users_test.rb
Expand Up @@ -133,10 +133,10 @@ class InvitingUsersTest < ActionDispatch::IntegrationTest
user = User.find_by(email: "fred@example.com")
visit edit_user_path(user)

click_link "Resend signup email"
click_button "Resend signup email"
click_link "Resend invitation email"
click_button "Resend invitation email"

assert page.has_content?("Resent account signup email")
assert page.has_content?("Resent account invitation email")
emails_received = all_emails.count { |email| email.subject == I18n.t("devise.mailer.invitation_instructions.subject") }
assert_equal 2, emails_received
end
Expand Down

0 comments on commit 72482d1

Please sign in to comment.