Skip to content

Commit b75daa2

Browse files
authored
Merge pull request #1116 from jjeffers/1079-better-ui-indication-when-deleting-user
Adds a flash notice when deleting a user from the admin user UI. closes #1079
2 parents 9801798 + a5bc184 commit b75daa2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

app/controllers/admin/users_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ def destroy
135135
@user.permanently_destroy
136136

137137
respond_to do |format|
138-
format.html { redirect_to admin_users_path }
138+
format.html { redirect_to admin_users_path,
139+
:flash => { :success => "User #{@user.name} was scheduled for permanent deletion." }}
139140
format.js { }
140141
end
141142
end

test/controllers/admin/users_controller_test.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ def uploaded_file_object(klass, attribute, file, content_type = 'text/plain')
7878
assert_response :success
7979
end
8080

81+
test "an admin should see a message that a user was scheduled to be deleted" do
82+
sign_in users(:admin)
83+
84+
user_name = User.find(3).name
85+
86+
delete :destroy, id: 3, locale: :en
87+
assert_response :redirect
88+
assert_equal "User #{user_name} was scheduled for permanent deletion.",
89+
flash[:success]
90+
end
91+
92+
8193
test "an admin should be able to anonymize a user" do
8294
sign_in users(:admin)
8395
xhr :post, :scrub, id: 3, locale: :en

0 commit comments

Comments
 (0)