FEATURE: allow version emails to be disabled globally

This commit is contained in:
Sam 2014-08-23 10:02:14 +10:00
parent ae9fcf17ef
commit f493eb5d12
2 changed files with 12 additions and 2 deletions

View File

@ -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

View File

@ -99,4 +99,9 @@ serve_static_assets = false
sidekiq_workers = 5
# adjust stylesheets to rtl (requires "rtlit" gem)
rtl_css = false
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