Add site_setting to disable version checks

This commit is contained in:
Neil Lalonde 2013-02-21 10:19:02 -05:00
parent cf595a56a8
commit 560411eece
5 changed files with 33 additions and 25 deletions

View File

@ -2,11 +2,13 @@
Discourse.AdminDashboardRoute = Discourse.Route.extend({
setupController: function(c) {
if( Discourse.SiteSettings.version_checks ) {
return Discourse.VersionCheck.find().then(function(vc) {
c.set('versionCheck', vc);
return c.set('loading', false);
});
}
}
});
}).call(this);

View File

@ -1,5 +1,6 @@
<h3>{{i18n admin.dashboard.welcome}}</h3>
{{#if Discourse.SiteSettings.version_checks}}
<p {{bindAttr class="priorityClass"}}>
{{#if loading }}
{{i18n loading}}
@ -19,3 +20,4 @@
</span>
{{/if}}
</p>
{{/if}}

View File

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

View File

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

View File

@ -5,9 +5,11 @@ module Jobs
class VersionCheck < Jobs::Base
def execute(args)
if SiteSetting.version_checks
json = DiscourseHub.discourse_version_check
DiscourseUpdates.latest_version = json['latestVersion']
DiscourseUpdates.critical_update_available = json['criticalUpdates']
end
true
end