Ask for confirmation when hiding/blocking users

In the moderation section there's no clear indicator as to what the
"Hide" and "Block" buttons do and the difference between them.

Since we're using confirmation dialogs in all moderation actions except
these ones, we're adding them here as well, so the difference will
appear in the dialog.

This isn't a very good solution, though, since the confirmation dialog
comes after clicking the button and users have already been wondering
whether clicking that button will be the right choice. A better solution
would be making the purpose clear before the button is clicked, although
that's something we don't do anywhere in the admin/moderation sections.
This commit is contained in:
Javi Martín
2021-12-29 20:33:15 +01:00
parent 992da1fef3
commit a31e73bf23
9 changed files with 36 additions and 9 deletions

View File

@@ -217,7 +217,9 @@ describe "Admin activity" do
visit proposal_path(proposal)
within("#proposal_#{proposal.id}") do
accept_confirm("Are you sure? Block author \"#{proposal.author.name}\"") { click_button "Block author" }
accept_confirm("Are you sure? This will hide the user \"#{proposal.author.name}\" and all their contents.") do
click_button "Block author"
end
expect(page).to have_current_path(proposals_path)
end
@@ -239,9 +241,11 @@ describe "Admin activity" do
visit moderation_users_path(search: user.username)
within("#moderation_users") do
click_button "Block"
accept_confirm { click_button "Block" }
end
expect(page).to have_content "The user has been blocked"
visit admin_activity_path
within first("tbody tr") do