discourse/spec/fabricators/user_history_fabricator.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

17 lines
502 B
Ruby

# frozen_string_literal: true
Fabricator(:user_history) { acting_user { Fabricate(:user) } }
Fabricator(:site_setting_change_history, from: :user_history) do
action { UserHistory.actions[:change_site_setting] }
previous_value { "old value" }
new_value { "new value" }
subject { "some_site_setting" }
end
Fabricator(:topic_closed_change_history, from: :user_history) do
action { UserHistory.actions[:topic_closed] }
subject { "some_site_setting" }
topic_id { Fabricate(:topic).id }
end