0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-14 13:58:53 +08:00
discourse/spec/system/page_objects/modals/bulk_user_suspend_confirmation.rb
Régis Hanol a1ebd19813
FEATURE: Bulk suspend users and filter the admin users list by activation (#41227)
- Adds an activation filter (All / Activated / Not activated) to the
Admin > Users > New tab so unverified accounts can be isolated in the
UI.
- Adds a bulk suspend action next to the existing bulk delete, plus a
"Select all" / "Clear all" control so a whole page of accounts can be
actioned at once.
- Shows the suspend reason on the Suspended tab, mirroring the silenced
tab.

Already-suspended users are excluded from bulk suspension, and the
penalty-reason columns are populated from a single batched query instead
of one query per row.

**SCREENSHOTS**

<img width="1400" height="1200"
alt="desktop-horizon-light-admin-users-activation-filter"
src="https://github.com/user-attachments/assets/31165d10-42cb-479b-897c-fafeb3283526"
/>
<img width="1400" height="1200"
alt="desktop-horizon-light-admin-users-bulk-select"
src="https://github.com/user-attachments/assets/037e8149-2ac6-40de-aaae-0d0e443ec143"
/>
<img width="1400" height="1200"
alt="desktop-horizon-light-admin-users-suspended"
src="https://github.com/user-attachments/assets/e6dbefed-4aaf-49bb-a9bd-52c7253e14b6"
/>
<img width="1400" height="1200"
alt="desktop-horizon-light-admin-users-bulk-suspend"
src="https://github.com/user-attachments/assets/5bdf85ef-4e30-4d8d-b521-d8639c1a2b97"
/>
2026-06-29 11:26:34 +02:00

62 lines
1.6 KiB
Ruby
Vendored

# frozen_string_literal: true
module PageObjects
module Modals
class BulkUserSuspendConfirmation < Base
MODAL_SELECTOR = ".bulk-user-suspend-confirmation"
def confirm
confirm_button.click
end
def confirm_button
within(modal) { find(".btn.confirm-suspend") }
end
def has_confirm_button_disabled?
within(modal) { has_css?(".btn.confirm-suspend[disabled]") }
end
def has_confirm_button_enabled?
within(modal) do
has_no_css?(".btn.confirm-suspend[disabled]") && has_css?(".btn.confirm-suspend")
end
end
def set_future_date(date)
select = PageObjects::Components::SelectKit.new(".future-date-input details")
select.expand
select.select_row_by_value(date)
end
def fill_in_reason(reason)
find("input.suspend-reason").fill_in(with: reason)
end
def has_successful_log_entry_for_user?(user:, position:, total:)
within(modal) do
has_css?(
".bulk-user-suspend-confirmation__progress-line.-success",
text:
I18n.t(
"admin_js.admin.users.bulk_actions.suspend.confirmation_modal.user_suspend_succeeded",
position:,
total:,
username: user.username,
),
)
end
end
def has_no_error_log_entries?
within(modal) { has_no_css?(".bulk-user-suspend-confirmation__progress-line.-error") }
end
private
def modal
find(MODAL_SELECTOR)
end
end
end
end