DEV: Don't clear cache/trigger events if site setting hasn't changed (#15045)

This commit is contained in:
Jarek Radosz 2021-11-22 16:43:12 +01:00 committed by GitHub
parent d91d67a442
commit 648332bc9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -355,6 +355,9 @@ module SiteSettingExtension
old_val = current[name]
provider.destroy(name)
current[name] = defaults.get(name, default_locale)
return if current[name] == old_val
clear_uploads_cache(name)
clear_cache!
DiscourseEvent.trigger(:site_setting_changed, name, old_val, current[name]) if old_val != current[name]
@ -369,6 +372,9 @@ module SiteSettingExtension
sanitized_val = sanitize_override ? sanitize_field(val) : val
provider.save(name, sanitized_val, type)
current[name] = type_supervisor.to_rb_value(name, sanitized_val)
return if current[name] == old_val
clear_uploads_cache(name)
notify_clients!(name) if client_settings.include? name
clear_cache!