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,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);
});
}
}
});

View File

@ -1,21 +1,23 @@
<h3>{{i18n admin.dashboard.welcome}}</h3>
<p {{bindAttr class="priorityClass"}}>
{{#if loading }}
{{i18n loading}}
{{else}}
{{i18n admin.dashboard.version}}: <span class="version-number">{{ versionCheck.installed_version }}</span>
{{#if Discourse.SiteSettings.version_checks}}
<p {{bindAttr class="priorityClass"}}>
{{#if loading }}
{{i18n loading}}
{{else}}
{{i18n admin.dashboard.version}}: <span class="version-number">{{ versionCheck.installed_version }}</span>
<span class="version-notes">
{{#if upToDate }}
<i class='icon icon-ok update-to-date'></i> {{i18n admin.dashboard.up_to_date}}
{{else}}
<i {{bindAttr class="updateIconClasses"}}></i>
<span class="critical-note">{{i18n admin.dashboard.critical_available}}</span>
<span class="normal-note">{{i18n admin.dashboard.updates_available}}</span>
{{i18n admin.dashboard.please_upgrade}}
{{i18n admin.dashboard.latest_version}}: <span class="version-number">{{ versionCheck.latest_version }}</span>
{{/if}}
</span>
{{/if}}
</p>
<span class="version-notes">
{{#if upToDate }}
<i class='icon icon-ok update-to-date'></i> {{i18n admin.dashboard.up_to_date}}
{{else}}
<i {{bindAttr class="updateIconClasses"}}></i>
<span class="critical-note">{{i18n admin.dashboard.critical_available}}</span>
<span class="normal-note">{{i18n admin.dashboard.updates_available}}</span>
{{i18n admin.dashboard.please_upgrade}}
{{i18n admin.dashboard.latest_version}}: <span class="version-number">{{ versionCheck.latest_version }}</span>
{{/if}}
</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)
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