diff --git a/app/assets/javascripts/admin/models/version_check.js b/app/assets/javascripts/admin/models/version_check.js index 958bef4564c..69978484842 100644 --- a/app/assets/javascripts/admin/models/version_check.js +++ b/app/assets/javascripts/admin/models/version_check.js @@ -8,8 +8,8 @@ **/ Discourse.VersionCheck = Discourse.Model.extend({ upToDate: function() { - return this.get('missing_versions_count') === 0; - }.property('missing_versions_count'), + return this.get('latest_version') === this.get('installed_version'); + }.property('latest_version', 'installed_version'), behindByOneVersion: function() { return this.get('missing_versions_count') === 1; diff --git a/lib/discourse_updates.rb b/lib/discourse_updates.rb index 00682e5119d..ea902d5078e 100644 --- a/lib/discourse_updates.rb +++ b/lib/discourse_updates.rb @@ -5,7 +5,7 @@ module DiscourseUpdates def check_version DiscourseVersionCheck.new( latest_version: latest_version || Discourse::VERSION::STRING, - critical_updates: critical_update_available?, + critical_updates: critical_updates_available?, installed_version: Discourse::VERSION::STRING, installed_sha: (Discourse.git_version == 'unknown' ? nil : Discourse.git_version), missing_versions_count: missing_versions_count || nil @@ -21,11 +21,11 @@ module DiscourseUpdates $redis.get(missing_versions_count_key).try(:to_i) end - def critical_update_available? + def critical_updates_available? ($redis.get(critical_updates_available_key) || false) == 'true' end - ['latest_version', 'missing_versions_count', 'critical_update_available'].each do |name| + ['latest_version', 'missing_versions_count', 'critical_updates_available'].each do |name| eval "define_method :#{name}= do |arg| $redis.set #{name}_key, arg end" diff --git a/lib/jobs/version_check.rb b/lib/jobs/version_check.rb index b2ef87b1fff..30c529ec58e 100644 --- a/lib/jobs/version_check.rb +++ b/lib/jobs/version_check.rb @@ -8,7 +8,7 @@ module Jobs if SiteSetting.version_checks json = DiscourseHub.discourse_version_check DiscourseUpdates.latest_version = json['latestVersion'] - DiscourseUpdates.critical_update_available = json['criticalUpdates'] + DiscourseUpdates.critical_updates_available = json['criticalUpdates'] DiscourseUpdates.missing_versions_count = json['missingVersionsCount'] end true diff --git a/spec/controllers/admin/versions_controller_spec.rb b/spec/controllers/admin/versions_controller_spec.rb index cffe321aa84..a8eea59741a 100644 --- a/spec/controllers/admin/versions_controller_spec.rb +++ b/spec/controllers/admin/versions_controller_spec.rb @@ -5,7 +5,7 @@ describe Admin::VersionsController do before do DiscourseUpdates.stubs(:latest_version).returns('1.2.33') - DiscourseUpdates.stubs(:critical_update_available?).returns(false) + DiscourseUpdates.stubs(:critical_updates_available?).returns(false) end it "is a subclass of AdminController" do