mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:06:26 +08:00
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:
parent
65164bf189
commit
886cf72b0e
|
@ -115,6 +115,10 @@ module DiscourseUpdates
|
||||||
keys.present? ? keys.map { |k| Discourse.redis.hgetall(k) } : []
|
keys.present? ? keys.map { |k| Discourse.redis.hgetall(k) } : []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def current_version
|
||||||
|
last_installed_version || Discourse::VERSION::STRING
|
||||||
|
end
|
||||||
|
|
||||||
def new_features_payload
|
def new_features_payload
|
||||||
response = Excon.new(new_features_endpoint).request(expects: [200], method: :Get)
|
response = Excon.new(new_features_endpoint).request(expects: [200], method: :Get)
|
||||||
response.body
|
response.body
|
||||||
|
@ -130,7 +134,7 @@ module DiscourseUpdates
|
||||||
return nil if entries.nil?
|
return nil if entries.nil?
|
||||||
|
|
||||||
entries.select! do |item|
|
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
|
end
|
||||||
|
|
||||||
entries.sort_by { |item| Time.zone.parse(item["created_at"]).to_i }.reverse
|
entries.sort_by { |item| Time.zone.parse(item["created_at"]).to_i }.reverse
|
||||||
|
|
Loading…
Reference in New Issue
Block a user