diff --git a/app/assets/javascripts/admin/routes/admin_dashboard_route.js b/app/assets/javascripts/admin/routes/admin_dashboard_route.js index 32456dceb43..f612341da06 100644 --- a/app/assets/javascripts/admin/routes/admin_dashboard_route.js +++ b/app/assets/javascripts/admin/routes/admin_dashboard_route.js @@ -2,10 +2,12 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({ setupController: function(c) { - return Discourse.VersionCheck.find().then(function(vc) { - c.set('versionCheck', vc); - return c.set('loading', false); - }); + if( Discourse.SiteSettings.version_checks ) { + return Discourse.VersionCheck.find().then(function(vc) { + c.set('versionCheck', vc); + return c.set('loading', false); + }); + } } }); diff --git a/app/assets/javascripts/admin/templates/dashboard.js.handlebars b/app/assets/javascripts/admin/templates/dashboard.js.handlebars index d2edd2f67cc..75f8ba18b06 100644 --- a/app/assets/javascripts/admin/templates/dashboard.js.handlebars +++ b/app/assets/javascripts/admin/templates/dashboard.js.handlebars @@ -1,21 +1,23 @@
- {{#if loading }} - {{i18n loading}} - {{else}} - {{i18n admin.dashboard.version}}: {{ versionCheck.installed_version }} +{{#if Discourse.SiteSettings.version_checks}} +
+ {{#if loading }} + {{i18n loading}} + {{else}} + {{i18n admin.dashboard.version}}: {{ versionCheck.installed_version }} - - {{#if upToDate }} - {{i18n admin.dashboard.up_to_date}} - {{else}} - - {{i18n admin.dashboard.critical_available}} - {{i18n admin.dashboard.updates_available}} - {{i18n admin.dashboard.please_upgrade}} - {{i18n admin.dashboard.latest_version}}: {{ versionCheck.latest_version }} - {{/if}} - - {{/if}} -
\ No newline at end of file + + {{#if upToDate }} + {{i18n admin.dashboard.up_to_date}} + {{else}} + + {{i18n admin.dashboard.critical_available}} + {{i18n admin.dashboard.updates_available}} + {{i18n admin.dashboard.please_upgrade}} + {{i18n admin.dashboard.latest_version}}: {{ versionCheck.latest_version }} + {{/if}} + + {{/if}} + +{{/if}} \ No newline at end of file diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb index 178e2a8e6a2..82d9011b70b 100644 --- a/app/models/site_setting.rb +++ b/app/models/site_setting.rb @@ -31,6 +31,7 @@ class SiteSetting < ActiveRecord::Base client_setting(:flush_timings_secs, 5) client_setting(:supress_reply_directly_below, true) client_setting(:email_domains_blacklist, 'mailinator.com') + client_setting(:version_checks, true) # settings only available server side setting(:auto_track_topics_after, 300000) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 6e70a79bc35..c8514304add 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -294,6 +294,7 @@ en: supress_reply_directly_below: "Don't show replies button below a post when the reply is directly below" allow_index_in_robots_txt: "Site should be indexed by search engines (update robots.txt)" email_domains_blacklist: "A pipe-delimited list of email domains that are not allowed. Example: mailinator.com|trashmail.net" + version_checks: 'Whether to check for Discourse updates and report them on the admin dashboard.' port: "If you'd like to specify a port in the URL. Useful in development mode. Leave blank for none." force_hostname: "If you'd like to specify a hostname in the URL. Useful in development mode. Leave blank for none." diff --git a/lib/jobs/version_check.rb b/lib/jobs/version_check.rb index 7e008c69306..d5652f5566f 100644 --- a/lib/jobs/version_check.rb +++ b/lib/jobs/version_check.rb @@ -5,9 +5,11 @@ module Jobs class VersionCheck < Jobs::Base def execute(args) - json = DiscourseHub.discourse_version_check - DiscourseUpdates.latest_version = json['latestVersion'] - DiscourseUpdates.critical_update_available = json['criticalUpdates'] + if SiteSetting.version_checks + json = DiscourseHub.discourse_version_check + DiscourseUpdates.latest_version = json['latestVersion'] + DiscourseUpdates.critical_update_available = json['criticalUpdates'] + end true end