discourse/spec/system/page_objects/pages/user.rb
Linca a3cff97b48
FEATURE: Make it easier for staff to see if a profile is silenced (#33537)
This commit make it easier for staff to see if a profile is silenced by
aligning it with how suspended notices are shown.

- The number of times a profile has been silenced is shown in the staff
counters banner at the top of the public user profiles.
- Clicking on the silenced note in the staff counters banner goes to a
filtered view of the staff action logs for the user and the silenced
action.
- The profile indicates if a user is silenced and shows the date they
are silenced until. This looks exactly the same as how it currently
displays for suspended users, with the added info of the date. This is
also displayed on the user card, the same as suspended notices currently
are.

## Screenshots


![image](https://github.com/user-attachments/assets/43cf8134-3391-43ff-98fe-fcba07c9e3dd)

![image](https://github.com/user-attachments/assets/2804dcba-70b2-4cf2-8a93-63433a23b481)
2025-07-14 12:44:31 +08:00

76 lines
2 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class User < PageObjects::Pages::Base
def visit(user)
page.visit("/u/#{user.username}")
self
end
def find(selector)
page.find(".new-user-wrapper #{selector}")
end
def active_user_primary_navigation
find(".user-navigation-primary li a.active")
end
def active_user_secondary_navigation
find(".user-navigation-secondary li a.active")
end
def has_warning_messages_path?(user)
page.has_current_path?("/u/#{user.username}/messages/warnings")
end
def has_primary_navigation_item?(name)
page.has_css?(primary_navigation_selector(name))
end
def has_no_primary_navigation_item?(name)
page.has_no_css?(primary_navigation_selector(name))
end
def has_secondary_navigation_item?(name)
page.has_css?(secondary_navigation_selector(name))
end
def has_no_secondary_navigation_item?(name)
page.has_no_css?(secondary_navigation_selector(name))
end
def click_staff_info_warnings_link(user, warnings_count: 0)
staff_counters = page.find(".staff-counters")
staff_counters.find("a[href='/u/#{user.username}/messages/warnings']").click
self
end
def click_staff_info_silencings_link
staff_counters = page.find(".staff-counters")
staff_counters.find("a:has(.silencings)").click
self
end
def expand_info_panel
button = page.find("button[aria-controls='collapsed-info-panel']")
button.click if button["aria-expanded"] == "false"
self
end
def click_primary_navigation_item(name)
page.find(primary_navigation_selector(name)).click
end
private
def primary_navigation_selector(name)
".new-user-wrapper .user-navigation-primary li.user-nav__#{name}"
end
def secondary_navigation_selector(name)
".new-user-wrapper .user-navigation-secondary li.user-nav__#{name}"
end
end
end
end