mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:16:38 -06:00
Fix check if you're up to date in javascript
This commit is contained in:
parent
208575f93d
commit
83f89b5c55
@ -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;
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user