summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-10-02 16:42:52 +0200
committerGitHub <noreply@github.com>2023-10-02 16:42:52 +0200
commit7e7d6e695b5b7ef8d8c10b1d9ac79375ca1b8209 (patch)
treee02fa179ea135c5dc9816b9f04de054b73076ed5
parent1e2d4975cfcc064b3cf40760b2bb66b3a26e2a40 (diff)
Fix incorrectly keeping outdated update notices absent from the API endpoint (#27021)
-rw-r--r--app/services/software_update_check_service.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/services/software_update_check_service.rb b/app/services/software_update_check_service.rb
index 49b92f104db..c8ce1753f5f 100644
--- a/app/services/software_update_check_service.rb
+++ b/app/services/software_update_check_service.rb
@@ -35,11 +35,13 @@ class SoftwareUpdateCheckService < BaseService
end
def process_update_notices!(update_notices)
- return if update_notices.blank? || update_notices['updatesAvailable'].blank?
+ return if update_notices.blank? || update_notices['updatesAvailable'].nil?
# Clear notices that are not listed by the update server anymore
SoftwareUpdate.where.not(version: update_notices['updatesAvailable'].pluck('version')).delete_all
+ return if update_notices['updatesAvailable'].blank?
+
# Check if any of the notices is new, and issue notifications
known_versions = SoftwareUpdate.where(version: update_notices['updatesAvailable'].pluck('version')).pluck(:version)
new_update_notices = update_notices['updatesAvailable'].filter { |notice| known_versions.exclude?(notice['version']) }