mirror of
https://github.com/discourse/discourse.git
synced 2026-08-11 05:25:16 -05:00
FIX: do not log category custom fields changes if the value is unchanged (#16712)
This commit is contained in:
@@ -387,6 +387,38 @@ describe StaffActionLogger do
|
||||
expect(UserHistory.count).to eq(1)
|
||||
expect(UserHistory.find_by_subject('name').category).to eq(category)
|
||||
end
|
||||
|
||||
it "logs custom fields changes" do
|
||||
attributes = {
|
||||
custom_fields: { "auto_populated" => "t" }
|
||||
}
|
||||
category.update!(attributes)
|
||||
|
||||
logger.log_category_settings_change(
|
||||
category,
|
||||
attributes,
|
||||
old_permissions: category.permissions_params,
|
||||
old_custom_fields: {}
|
||||
)
|
||||
|
||||
expect(UserHistory.count).to eq(1)
|
||||
end
|
||||
|
||||
it "does not log custom fields changes if value is unchanged" do
|
||||
attributes = {
|
||||
custom_fields: { "auto_populated" => "t" }
|
||||
}
|
||||
category.update!(attributes)
|
||||
|
||||
logger.log_category_settings_change(
|
||||
category,
|
||||
attributes,
|
||||
old_permissions: category.permissions_params,
|
||||
old_custom_fields: { "auto_populated" => "t" }
|
||||
)
|
||||
|
||||
expect(UserHistory.count).to eq(0)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'log_category_deletion' do
|
||||
|
||||
Reference in New Issue
Block a user