mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Apply syntax_tree formatting to config/*
This commit is contained in:
@@ -6,10 +6,11 @@ DiscourseEvent.on(:site_setting_changed) do |name, old_value, new_value|
|
||||
# Enabling `must_approve_users` on an existing site is odd, so we assume that the
|
||||
# existing users are approved.
|
||||
if name == :must_approve_users && new_value == true
|
||||
|
||||
User.where(approved: false)
|
||||
User
|
||||
.where(approved: false)
|
||||
.joins("LEFT JOIN reviewables r ON r.target_id = users.id")
|
||||
.where(r: { id: nil }).update_all(approved: true)
|
||||
.where(r: { id: nil })
|
||||
.update_all(approved: true)
|
||||
end
|
||||
|
||||
if name == :emoji_set
|
||||
@@ -19,31 +20,28 @@ DiscourseEvent.on(:site_setting_changed) do |name, old_value, new_value|
|
||||
after = "/images/emoji/#{new_value}/"
|
||||
|
||||
Scheduler::Defer.later("Fix Emoji Links") do
|
||||
DB.exec("UPDATE posts SET cooked = REPLACE(cooked, :before, :after) WHERE cooked LIKE :like",
|
||||
DB.exec(
|
||||
"UPDATE posts SET cooked = REPLACE(cooked, :before, :after) WHERE cooked LIKE :like",
|
||||
before: before,
|
||||
after: after,
|
||||
like: "%#{before}%"
|
||||
like: "%#{before}%",
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
Stylesheet::Manager.clear_color_scheme_cache! if [:base_font, :heading_font].include?(name)
|
||||
Stylesheet::Manager.clear_color_scheme_cache! if %i[base_font heading_font].include?(name)
|
||||
|
||||
Report.clear_cache(:storage_stats) if [:backup_location, :s3_backup_bucket].include?(name)
|
||||
Report.clear_cache(:storage_stats) if %i[backup_location s3_backup_bucket].include?(name)
|
||||
|
||||
if name == :slug_generation_method
|
||||
Scheduler::Defer.later("Null topic slug") do
|
||||
Topic.update_all(slug: nil)
|
||||
end
|
||||
Scheduler::Defer.later("Null topic slug") { Topic.update_all(slug: nil) }
|
||||
end
|
||||
|
||||
Jobs.enqueue(:update_s3_inventory) if [:enable_s3_inventory, :s3_upload_bucket].include?(name)
|
||||
Jobs.enqueue(:update_s3_inventory) if %i[enable_s3_inventory s3_upload_bucket].include?(name)
|
||||
|
||||
SvgSprite.expire_cache if name.to_s.include?("_icon")
|
||||
|
||||
if SiteIconManager::WATCHED_SETTINGS.include?(name)
|
||||
SiteIconManager.ensure_optimized!
|
||||
end
|
||||
SiteIconManager.ensure_optimized! if SiteIconManager::WATCHED_SETTINGS.include?(name)
|
||||
|
||||
# Make sure medium and high priority thresholds were calculated.
|
||||
if name == :reviewable_low_priority_threshold && Reviewable.min_score_for_priority(:medium) > 0
|
||||
|
||||
Reference in New Issue
Block a user