discourse/spec/system/page_objects/pages/admin_staff_action_logs.rb
Martin Brennan e94ab11477
DEV: Allow for setting a message with SiteSetting.set_and_log (#27447)
When we turn on settings automatically for customers,
we sometimes use `.set_and_log` which will make a staff
action log for the site setting change. This is fine, but
there is no context for customers.

This change allows setting a message with `.set_and_log`, which
will be stored in the `details` column of the staff action log
created, which will show up on `/admin/logs/staff_action_logs`

---------

Co-authored-by: Kelv <kelv@discourse.org>
2024-06-13 14:59:49 +10:00

35 lines
972 B
Ruby

# frozen_string_literal: true
module PageObjects
module Pages
class AdminStaffActionLogs < PageObjects::Pages::Base
def visit
page.visit "admin/logs/staff_action_logs"
self
end
def log_row_selector(user_history)
".staff-logs tr[data-user-history-id='#{user_history.id}']"
end
def log_row(user_history)
find(log_row_selector(user_history))
end
def has_log_row?(user_history)
has_css?(log_row_selector(user_history))
end
def has_no_log_row?(user_history)
has_no_css?(log_row_selector(user_history))
end
def filter_by_action(action)
filter = PageObjects::Components::SelectKit.new("#staff-action-logs-action-filter")
filter.search(I18n.t("admin_js.admin.logs.staff_actions.actions.change_site_setting"))
filter.select_row_by_value(UserHistory.actions.key(UserHistory.actions[action.to_sym]).to_s)
end
end
end
end