discourse/spec/system/page_objects/pages/admin_user.rb
Osama Sayegh 0bc18fdf78
FEATURE: Add site setting to prevent mods from changing trust levels (#35160)
This commit adds a new setting `moderators_change_trust_levels` to
control whether moderators are allowed to change trust level of users.
Moderators are currently allowed to change trust levels, so this new
setting is enabled by default to avoid sudden changes in behavior for
existing sites.

When the setting is disabled and moderators are not allowed to change
trust levels, they see the trust levels dropdown disabled.

Internal topic: t/141392.

---------

Co-authored-by: Alan Guo Xiang Tan <gxtan1990@gmail.com>
2025-10-03 13:19:24 +03:00

56 lines
1.3 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class AdminUser < PageObjects::Pages::Base
def visit(user)
page.visit("/admin/users/#{user.id}/#{user.username}")
end
def has_suspend_button?
has_css?(".btn-danger.suspend-user")
end
def has_no_suspend_button?
has_no_css?(".btn-danger.suspend-user")
end
def has_silence_button?
has_css?(".btn-danger.silence-user")
end
def has_no_silence_button?
has_no_css?(".btn-danger.silence-user")
end
def has_change_trust_level_dropdown_enabled?
has_css?(".change-trust-level-dropdown") &&
has_no_css?(".change-trust-level-dropdown.is-disabled")
end
def has_change_trust_level_dropdown_disabled?
has_css?(".change-trust-level-dropdown.is-disabled")
end
def click_suspend_button
find(".btn-danger.suspend-user").click
end
def click_unsuspend_button
find(".btn-danger.unsuspend-user").click
end
def click_silence_button
find(".btn-danger.silence-user").click
end
def click_unsilence_button
find(".btn-danger.unsilence-user").click
end
def similar_users_warning
find(".penalty-similar-users .alert-warning")["innerHTML"]
end
end
end
end