mirror of
https://github.com/discourse/discourse.git
synced 2026-08-07 13:19:19 +08:00
- 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" />
113 lines
2.7 KiB
Ruby
Vendored
113 lines
2.7 KiB
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Pages
|
|
class AdminUsers < AdminBase
|
|
class UserRow
|
|
attr_reader :element
|
|
|
|
def initialize(element)
|
|
@element = element
|
|
end
|
|
|
|
def bulk_select_checkbox
|
|
element.find(".directory-table__cell-bulk-select")
|
|
end
|
|
|
|
def has_bulk_select_checkbox?
|
|
element.has_css?(".directory-table__cell-bulk-select")
|
|
end
|
|
|
|
def has_no_bulk_select_checkbox?
|
|
element.has_no_css?(".directory-table__cell-bulk-select")
|
|
end
|
|
|
|
def username
|
|
element.find("a[href^='/admin/users']")
|
|
end
|
|
end
|
|
|
|
def visit
|
|
page.visit("/admin/users/list/active")
|
|
end
|
|
|
|
def bulk_select_button
|
|
find(".btn.bulk-select")
|
|
end
|
|
|
|
def bulk_select_all_button
|
|
find(".btn.bulk-select-all")
|
|
end
|
|
|
|
def bulk_clear_all_button
|
|
find(".btn.bulk-clear-all")
|
|
end
|
|
|
|
def search_input
|
|
find(".admin-users-list__search input")
|
|
end
|
|
|
|
def user_row(id)
|
|
UserRow.new(find(".directory-table__row[data-user-id=\"#{id}\"]"))
|
|
end
|
|
|
|
def users_count
|
|
all(".directory-table__row").size
|
|
end
|
|
|
|
def has_correct_breadcrumbs?
|
|
expect(all(".d-breadcrumbs__item").map(&:text)).to eq(
|
|
[I18n.t("js.admin_title"), I18n.t("admin_js.admin.users.title")],
|
|
)
|
|
end
|
|
|
|
def has_users?(user_ids)
|
|
user_ids.all? { |id| has_css?(".directory-table__row[data-user-id=\"#{id}\"]") }
|
|
end
|
|
|
|
def has_no_users?(user_ids)
|
|
user_ids.all? { |id| has_no_css?(".directory-table__row[data-user-id=\"#{id}\"]") }
|
|
end
|
|
|
|
def bulk_actions_dropdown
|
|
PageObjects::Components::DMenu.new(find(".bulk-select-admin-users-dropdown-trigger"))
|
|
end
|
|
|
|
def has_bulk_actions_dropdown?
|
|
has_css?(".bulk-select-admin-users-dropdown-trigger")
|
|
end
|
|
|
|
def has_no_bulk_actions_dropdown?
|
|
has_no_css?(".bulk-select-admin-users-dropdown-trigger")
|
|
end
|
|
|
|
def has_usernames?(usernames)
|
|
expect(all(".directory-table__cell.username").map(&:text)).to eq(usernames)
|
|
end
|
|
|
|
def has_none_users?
|
|
has_content?(I18n.t("js.search.no_results"))
|
|
end
|
|
|
|
def has_no_emails?
|
|
has_no_css?(".directory-table__column-header--email")
|
|
end
|
|
|
|
def has_emails?
|
|
has_css?(".directory-table__column-header--email")
|
|
end
|
|
|
|
def click_show_emails
|
|
find(".admin-users__subheader-show-emails").click
|
|
end
|
|
|
|
def click_send_invites
|
|
find(".admin-users__header-send-invites").click
|
|
end
|
|
|
|
def click_export
|
|
find(".admin-users__header-export-users").click
|
|
end
|
|
end
|
|
end
|
|
end
|