mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
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>
This commit is contained in:
@ -569,6 +569,16 @@ RSpec.describe SiteSettingExtension do
|
||||
expect(UserHistory.last.previous_value).to eq("Discourse v1")
|
||||
expect(UserHistory.last.new_value).to eq("Discourse v2")
|
||||
end
|
||||
|
||||
context "when a detailed message is provided" do
|
||||
let(:message) { "We really need to do this, see https://meta.discourse.org/t/123" }
|
||||
|
||||
it "adds the detailed message to the user history record" do
|
||||
expect {
|
||||
settings.set_and_log("title", "Discourse v2", Discourse.system_user, message)
|
||||
}.to change { UserHistory.last.try(:details) }.to(message)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "filter domain name" do
|
||||
|
Reference in New Issue
Block a user