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
app
assets/javascripts/admin
models
config/locales
lib/jobs

View file

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

View file

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

View file

@ -31,6 +31,7 @@ class SiteSetting < ActiveRecord::Base
client_setting(:flush_timings_secs, 5) client_setting(:flush_timings_secs, 5)
client_setting(:supress_reply_directly_below, true) client_setting(:supress_reply_directly_below, true)
client_setting(:email_domains_blacklist, 'mailinator.com') client_setting(:email_domains_blacklist, 'mailinator.com')
client_setting(:version_checks, true)
# settings only available server side # settings only available server side
setting(:auto_track_topics_after, 300000) 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" 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)" 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" 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." 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." 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 class VersionCheck < Jobs::Base
def execute(args) def execute(args)
json = DiscourseHub.discourse_version_check if SiteSetting.version_checks
DiscourseUpdates.latest_version = json['latestVersion'] json = DiscourseHub.discourse_version_check
DiscourseUpdates.critical_update_available = json['criticalUpdates'] DiscourseUpdates.latest_version = json['latestVersion']
DiscourseUpdates.critical_update_available = json['criticalUpdates']
end
true true
end end