From f493eb5d1234954a2384873dfdbdbf122a2186f9 Mon Sep 17 00:00:00 2001 From: Sam Date: Sat, 23 Aug 2014 10:02:14 +1000 Subject: [PATCH] FEATURE: allow version emails to be disabled globally --- app/jobs/scheduled/version_check.rb | 7 ++++++- config/discourse_defaults.conf | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/jobs/scheduled/version_check.rb b/app/jobs/scheduled/version_check.rb index a2a0920a4c3..9fb39252ee4 100644 --- a/app/jobs/scheduled/version_check.rb +++ b/app/jobs/scheduled/version_check.rb @@ -18,9 +18,14 @@ module Jobs DiscourseUpdates.updated_at = Time.zone.now DiscourseUpdates.missing_versions = json['versions'] - if SiteSetting.new_version_emails and json['missingVersionsCount'] > 0 and prev_missing_versions_count < json['missingVersionsCount'].to_i + if GlobalSetting.new_version_emails and + SiteSetting.new_version_emails and + json['missingVersionsCount'] > 0 and + prev_missing_versions_count < json['missingVersionsCount'].to_i + message = VersionMailer.send_notice Email::Sender.new(message, :new_version).send + end rescue => e raise e unless Rails.env.development? # Fail version check silently in development mode diff --git a/config/discourse_defaults.conf b/config/discourse_defaults.conf index 1299a36ad25..9ec99521805 100644 --- a/config/discourse_defaults.conf +++ b/config/discourse_defaults.conf @@ -99,4 +99,9 @@ serve_static_assets = false sidekiq_workers = 5 # adjust stylesheets to rtl (requires "rtlit" gem) -rtl_css = false \ No newline at end of file +rtl_css = false + +# notify admin when a new version of discourse is released +# this is global so it is easier to set in multisites +# TODO allow for global overrides +new_version_emails = true