discourse/spec/system/page_objects/components/user_card.rb
Osama Sayegh fb075f3f29
FIX: prevent silence_reason from leaking private email body (#39337)
When an admin silences a user with both a reason and an email message,
the private email body was visible publicly on user profile cards.

This applies the same fix previously used (commit 4ae1bba) for
suspension reasons: only the short reason is shown publicly, while the
full text including the email body is reserved for admin views.
2026-04-17 17:45:09 +03:00

46 lines
1.2 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Components
class UserCard < PageObjects::Components::Base
USER_CARD_SELECTOR = ".user-card"
FILTER_BUTTON_SELECTOR = "#{USER_CARD_SELECTOR} .usercard-controls .d-icon-filter"
def visible?
has_css?(USER_CARD_SELECTOR)
end
def showing_user?(username)
has_css?("#{USER_CARD_SELECTOR}.user-card-#{username}")
end
def has_filter_button?
has_css?(FILTER_BUTTON_SELECTOR)
end
def has_no_filter_button?
has_no_css?(FILTER_BUTTON_SELECTOR)
end
def filter_button_text
find("#{FILTER_BUTTON_SELECTOR} + .d-button-label").text
end
def click_filter_button
find("#{FILTER_BUTTON_SELECTOR} + .d-button-label").click
end
def has_profile_hidden?
has_css?("#{USER_CARD_SELECTOR} .profile-hidden", visible: true)
end
def has_inactive_user?
has_css?("#{USER_CARD_SELECTOR} .inactive-user", visible: true)
end
def silence_reason_description
find("#{USER_CARD_SELECTOR} .silence-reason .silence-reason-description").text
end
end
end
end