FIX: Fall back to hardcoded version when period check disabled (#12784)

When `SiteSetting.version_checks?` is disabled, the Discourse version is
not stored in Redis, so we need to fall back to the hardcoded value.
This commit is contained in:
Penar Musaraj 2021-04-21 12:40:27 -04:00 committed by GitHub
parent 65164bf189
commit 886cf72b0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -115,6 +115,10 @@ module DiscourseUpdates
keys.present? ? keys.map { |k| Discourse.redis.hgetall(k) } : []
end
def current_version
last_installed_version || Discourse::VERSION::STRING
end
def new_features_payload
response = Excon.new(new_features_endpoint).request(expects: [200], method: :Get)
response.body
@ -130,7 +134,7 @@ module DiscourseUpdates
return nil if entries.nil?
entries.select! do |item|
item["discourse_version"].nil? || Discourse.has_needed_version?(last_installed_version, item["discourse_version"]) rescue nil
item["discourse_version"].nil? || Discourse.has_needed_version?(current_version, item["discourse_version"]) rescue nil
end
entries.sort_by { |item| Time.zone.parse(item["created_at"]).to_i }.reverse