Skip to content

Commit

Permalink
Merge pull request #2502 from alphagov/fix-redirect-after-admin-updat…
Browse files Browse the repository at this point in the history
…es-another-users-name

Fix redirect after admin updates another user's name
  • Loading branch information
floehopper authored Nov 9, 2023
2 parents de64c49 + f1b02b1 commit 62a58f0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/users/names_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def edit; end
def update
if @user.update(user_params)
EventLog.record_event(@user, EventLog::ACCOUNT_UPDATED, initiator: current_user, ip_address: user_ip_address)
redirect_to user_path(@user), notice: "Updated user #{@user.email} successfully"
redirect_to edit_user_path(@user), notice: "Updated user #{@user.email} successfully"
else
render :edit
end
Expand Down
2 changes: 1 addition & 1 deletion test/controllers/users/names_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class Users::NamesControllerTest < ActionController::TestCase

put :update, params: { user_id: user, user: { name: "new-user-name" } }

assert_redirected_to user_path(user), notice: "Updated name of user@gov.uk successfully"
assert_redirected_to edit_user_path(user), notice: "Updated name of user@gov.uk successfully"
end

should "update user name if UserPolicy#update? returns true" do
Expand Down

0 comments on commit 62a58f0

Please sign in to comment.